Re: Fastest Way to Check Word in Dictionary
- Posted by robcraig Oct 27, 2008
- 1297 views
What's the fastest way to check if a word is in a dictionary? (I need a function for this, if anybody's got one.)
Seriously, though, what does your dictionary look like? Or what are your specs for a hypothetical dictionary, if that's what you're thinking about?
I'm just using WORDS.TXT. It's got 51796 words in it. I just want to check some words against that dictionary.
Junko solved that problem years ago, at least in the case where the words are all in memory...
http://www.rapideuphoria.com/spellchk.zip
If the words are stored as records in a Euphoria database, the EDS binary search algorithm would find a word pretty fast.
Rob
Rob, I saw that but I need a function I can call, not a command line interface. Maybe you guys can convert that and give it an API.
OK, you knew I couldn't resist...
I've posted a new Recent User Contribution that should help.
It creates a Euphoria database with over 50,000 English words as records in the database. (The data portion of each record is set to 0. The word is the key portion.)
You can call a library routine, passing a word. You'll get back a simple TRUE or FALSE, depending on whether the word is in the database (English dictionary) or not.
Rob