searching dictionary
BlitzPlus Forums/BlitzPlus Programming/searching dictionary
| ||
Hi, I would like to search a dictionary file to see if a word is valid. I have a text file where all english words are listed alphabetically separated by a space. I have my own ideas of how I could acheive this but thought it was worthwhile asking you guys as often someone will suggest a much better why of acheiving the same end result. My idea was to load all the words into 26 banks which handles match the start letter. And then search through the relevant bank to see if there is a match. I really need this function to operate very fast as it will hopefully be used in the main game loop. Please let me know any ideas you may have and code examples if possible. Thanks in advance. |
| ||
If you are only verifying if a word is valid, then couldn't you furthur break down your database by word lengths? That way, you won't waste time comparing longer words with shorter ones. A quick string length check would directly point you to the correct section of the database. |
| ||
WolRon, doesn't the dictionary have long words on both sides of short ones? Oh, wait. I understand. You're right. |
| ||
If you're writing a word puzzle game then perhaps this link may be of use. |
| ||
I went to that site that Fred linked to. The downloadable dictionary file is AWESOME but the code I wrote to go with it won't work but that is my problem. |