Word lookup proc that scans dictionary websites, and lets you check for spelling. Great for word games! [More]
This library is critical for creating word games in BYOND, or any other application that requires English language word verification. The popular BYOND game Kwijibo is a great example of what can be accomplished using this library.
New in version 3
8,020 word starter dictionary now included! Make sure you make a copy of this file (words_good.sav) to your game directory if you want to take advantage of it.
yourdictionary.com is no longer used as one of the backup dictionaries because of reliability issues. It has been replaced with a dictionary from a Notre Dam American English Spellchecker site hosted in Japan.
The meat of the code is word_lookup(), which will return 1 if the word passed is found in an online dictionary, 0 if it is not found, and -1 if the dictionary sites cannot be reached. There are currently two different dictionary sites that are checked, in case one is not responding. The preferred site is very fast, but if it is down, the library will automatically switch to the backup site.
The proc also learns the words after looking them up, so it needn't check the web a second time. The word is then added to the file words_good.sav, and saved for future runs of your program. Having a large local dictionary file is necessary for any game that uses AI to choose legal words, but not necessary for games where only a legality check is needed. In either case, it does greatly speed up checks.
The lookup time is fairly quick, typically less than half a second per word on the default dictionary site, but may be slower for servers on dial-up connections. On subsequent lookups, the value for a word is read from an associative list, so is almost instantaneous.