A Dictionary created from a HashSet


You can easily create a spell checker from a list of words stored in a HashSet.

Here is a program that you can use to create the HashSet and save it as a file.

Here are some instructions on how to use it once you have it.

Here is a sample HashSet stored in a file. This was created from the Linux word list. This file is about 500K. You can just use this file if it suits your needs without creating another. You should save these two files if you want them. Right click the links and select Save Link As... from the menu.


Note that you don't actually need the first program if the set provided above is enough for you. However, you can use it to create a hash set with your own words. Also note that the linux words are in alphabetical order, but that isn't important for our purposes here. In the hash set they won't be in order of course.

I use the program separately from my server and client to create the hash set and store it in a file. The program isn't part of my server or my client. It is just a utility that puts a bunch of words in a data structure and then saves that to a disk. The stuff in the "instructions" avove is incorporated into the startup of my server. The file created by the program is stored with the java code so that it can be found. Since this file is read in only once when the server starts, you don't pay any penalty when a client connects to the server.

You can also extend the functionality a bit in the following way. After the server reads in the hash set it can also look for another file of extra words that you provide. If it finds this file it reads it and puts the words in it into the hash set. This also happens at server startup. It gives you a simple way to extend the base file when the server starts. Of course, you can add files to the hash set at any time. But if you do you may want to write the file back to the disk to save those words for the next time the server starts up.