1. Fastest Way to Check Word in Dictionary
- Posted by euphoric (admin) Oct 27, 2008
- 1279 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.)
Thanks!
2. Re: Fastest Way to Check Word in Dictionary
- Posted by mattlewis (admin) Oct 27, 2008
- 1289 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.)
I just use an empty dictionary, so I always know the answer is no. :P
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?
Matt
3. Re: Fastest Way to Check Word in Dictionary
- Posted by bernie Oct 27, 2008
- 1278 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.)
Thanks!
It would probably depend on the size of dictionary.
- small: then use binary search.
- medium: use maps or database.e
- large: use odbc to large database.
4. Re: Fastest Way to Check Word in Dictionary
- Posted by euphoric (admin) Oct 27, 2008
- 1250 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.
5. Re: Fastest Way to Check Word in Dictionary
- Posted by robcraig Oct 27, 2008
- 1318 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
6. Re: Fastest Way to Check Word in Dictionary
- Posted by euphoric (admin) Oct 27, 2008
- 1335 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.
7. Re: Fastest Way to Check Word in Dictionary
- Posted by robcraig Oct 27, 2008
- 1298 views
- Last edited Oct 28, 2008
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
8. Re: Fastest Way to Check Word in Dictionary
- Posted by euphoric (admin) Oct 27, 2008
- 1246 views
- Last edited Oct 28, 2008
OK, you knew I couldn't resist...
I also need a program that will deposit one million dollars into my checking account...
9. Re: Fastest Way to Check Word in Dictionary
- Posted by euphoric (admin) Oct 27, 2008
- 1211 views
- Last edited Oct 28, 2008
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.
That's great Rob. Thanks!
10. Re: Fastest Way to Check Word in Dictionary
- Posted by egg Oct 28, 2008
- 1242 views
integer flag one can use sign of the returned value instead of flag
function findPos(sequence s,sequence ss) searching string ss in sorted list s
integer lo,hi,mid,c lo = 1 hi = length(ss)
c = compare(s,ss[1]) if c<0 then found = 0 return 1 elsif not c then found = 1 return 1 end if
c = compare(s,ss[hi]) if c>0 then found = 0 return hi+1 elsif not c then found = 1 return hi end if
while 1 do w = hi - lo if not w then found = 0 return hi elsif w<10 then lo += 1 while 1 do c = compare(s,ss[lo]) if not c then found = 1 return lo elsif c<0 then found = 0 return lo else lo += 1 end if end while else (hi-lo)>=10 mid = floor((lo + hi) / 2) c = compare(s,ss[mid]) if c<0 then x < ss[mid] hi = mid elsif c>0 then x > ss[mid] lo = mid else x = ss[mid] found = 1 return mid end if end if end while end function findPos
11. Re: Fastest Way to Check Word in Dictionary
- Posted by achury Nov 06, 2008
- 1256 views
- Last edited Nov 07, 2008
The dictionary as database is great. I found in the net a list of 80.000+ words on spanish. The list replaces the accented characters separating the accent and the vowel, á is replaced by `a and ñ by ~n. This way you avoid problem with codepages, but is needed a lot some aditional code in order to make the word check.
For the interested people: A page listing where to find word lists on spanish: http://olea.org/proyectos/lemarios/
I had the same idea as Jacques. Is a waste to have a database only with key, you can make a lot of interesting thing with the definition.
By sure wiktionary.org have not legal problems to download.
You can search definition of spanish words from: http://www.rae.es/rae.html
The contents side on dictionary may include also a field for translation to another language.
Marco Achury