At 5:54 PM -0400 4/7/06, [EMAIL PROTECTED] wrote:

I have obtained a dictionary in the form of a few hundred thousand words in a text file. I don't need definitions, I just need to be able to see if a word exists.

The entire file is 3.9 meg. Since I won't really need to change it, I was thinking that it would be convienent if I could just embed the dictionary in my app.

Now for the questions: If I use a REALSQLDatabase, will I be able to read it while it's embedded in the application? Is there another way of building my dictionary into my app? The lookup process needs to be extremely fast - which is why I thought about a database first.

If it were me, I'd just drag the text file directly into the project. Then at app startup (or better yet, the first time you need to look up a word), split the file on its end-of-line delimiter and stuff the words into a Dictionary object (as keys, with a dummy value like True).

Stuffing the dictionary with 3.9 MB of data might take a second or so, but then lookup (using Dictionary.HasKey) will be blazingly fast. Also, since you know ahead of time how many words you'll be stuffing, you can make the stuffing go faster by pre-sizing the dictionary (i.e., assign a suitably large BinCount before you start loading in values).

Best,
- Joe

--

Joe Strout  --  [EMAIL PROTECTED]
Available for custom REALbasic programming and training.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to