|
Re: search a large text file for a word
|
Posted: Aug 23, 2003 5:20 PM
|
|
If your dictionary is categorized alphabetically I think it will be possible for you to create another small text file containing information on which line the words with that alphabet starts and where it ends
The text file might look something like this
A,1,121 B,122,200 ... ... ... Z,1001,1211
Something like that. The first number indicates where it starts and the second line indicates where the words Starting with A ends. So when you come across a word you can check against this file and load only that particular segment related to the first letter of the word.
This will solve your problem of how much to load in your memory and also make your search much faster since you are going to avoid on worst case searching 25 other segments which are guaranteed to not to have the word.
|
|