Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spell Checking Question

Status
Not open for further replies.

docmeizie

Programmer
Aug 5, 2003
326
US
Okay when spell check runs, it has to reference a database of all the words that are words. I really want to know what it is referencing so perhaps I can reference in a project I am working on myself. I know this can be done cause you can reference the spell checker on a form by going through Word. But I am trying not to have to go through Word. I am creating a game that compares the all the words a user comes up with to all viable words for a given set of letters mixed up.

If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmmv [pc1][shocked]
 
strongm

I agree that Dictioanry requires less coding but am I missing something obvious? Is there a way of loading a Dictionary quicker than using the .Add method?

To load the file and do a split into the basic array takes approx 1.4 seconds (as a complied .exe)

To load the Dictionary from the array using .Add takes an additional approx 7.3 seconds (also compiled)

I also got some interesting results on actually finding words. All these figures are averaged over 10000 repeats

[tt]
Using Dictionary Using BSA
abacus 24.9 microsec 10.8 microsec
monolith 18.0 10.9
zoo 9.1 10.5
[/tt]

BSA seems to be fairly consistent, but Dictionary appears to find the latest additions much faster than the early ones. Any thoughts on why that might be, and how I could load the Dictionary faster?

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Looking up a single word 10,000 times will not properly demonstrate any speed differential. We could both get a lucky hit onto a word that sits right on a binary power multiple boundary.

Instead, I suggest that we submit the entire contents of the dictionary to the dictionary, or even submit the reversed-word contents of the dictionary. This will give us both the same set of words to time.

We should use a consistent method to time it, and I also propose 3 separate times: Dictionary load time (from file); index creation time (for you, zero, but put the timer in there anyway), then lookup time for all the reversed words. I suppose the total time can be included.

That is, we should use the same timeGetTime function or whatever.

What say you?
 
Unfortunately I am back at work and can't work on my pet projects... that must wait until my own time. And also unfortunately, I am going out of the country for 2 weeks on Thursday, so my time is mostly eaten up by preparation. I may not be able to do this soon. :-(

I will see what I can do, and if necessary will revive this thread when I return.

-E
 

>Is there a way of loading a Dictionary quicker than using the .Add method?

Sadly not...however, I was going with ESquared's request that we "...not have its build-time at program startup counted"

Plus, can I confirm that you are using the Dictionary object's .Exists method rather than .Item property when doing your timings, as this a much closer match to your FindWord function?
 
Esquared,

Regarding lucky hits on boundaries, I've just tested with 'loaves' (on the very first division) and I get 4.2 microsec . It's the first one I've found that gives significantly different times though.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
The reason I want to program my own Dictionary object is that I found the speed of .Adding things to collections to be very slow. In my own code I will do work to try and optimize adding new words.

Last time I did this I used RtlMoveMemory for sorting, basically treating an array of strings as pointers and rearranging them at will.

I don't want to use the scripting object because of speed issues, and also I want additional functionality that I don't think it provides, like anagram serving. Admittedly, I haven't checked it out... hehe
 
I can't build the index I had envisioned if there are nonalpha characters in the dictionary. Now what do I do?

Sigh.
 
strongm,
Yes I was using the .Exists method

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top