Greetings,
I am developing a spell checker for a client. The dictionary word list that I have put together is over 100,000 words (1 word per line).
My script sets wholematches to true and then uses wordoffset(XX,YY) to see if the typed word is in my list of words.
If I check each word on the fly as I type, the search is plenty fast (3 ticks), however, when I use the same code to check each word in the whole field all at once, then I am looking at 3 ticks per word which gets pretty lengthy on a long text field.
I am not skilled at doing searches or setting up a word list to speed a search up. Is there a better way to do this?
Thanks!
John Miller
Spell Checker Search
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
I did a program once that searched a large dictionary file for rhyming words... I ran into a problem where it was slow because I was going line for line in a repeat loop.
Someone told me to do the following, and it was a huge... Huge speed increase!
tData being your full dictionary data. tLine would contain the data for a single line.
This sure beat my way of doing something like
Don't ask me why the "for each line" loop works faster.. I don't know, but it does.
~Garrett
Someone told me to do the following, and it was a huge... Huge speed increase!
Code: Select all
repeat for each line tLine in tData
--do your stuff here
end repeat
This sure beat my way of doing something like
Code: Select all
put the number of lines of tData into tLoopCounter
repeat tLoopCounter times
--do stuff here
end repeat
~Garrett
Hi John,
to increase speed you could split your word list into smaller lists that could e.g. start with the letter of the alphabet. All words of your 100000 words starting with A go into an A-list, and so on. That would speed things up and is relatively easy to implement.
If you want a faster way you could go for on or more (see above) arrays. There was a rev newsletter that uses that approach
cheers
Bernd
to increase speed you could split your word list into smaller lists that could e.g. start with the letter of the alphabet. All words of your 100000 words starting with A go into an A-list, and so on. That would speed things up and is relatively easy to implement.
If you want a faster way you could go for on or more (see above) arrays. There was a rev newsletter that uses that approach
that could speed up things considerably but is a little more involved. Though it might be a very good opportunity to look into arrays.
cheers
Bernd