Spell Checker
This program is a very simple spell checker. I am providing the driver
for this program, it will do all of the argument handling and I/O. You
are only responsible for the structures and algorithms.
For this to work all of the listed class and method names must match
exactly what the assignment states. You will get runtime exceptions if
you do this incorrectly.
Soundex
This is the soundex you wrote earlier in the semester.
- String soundex ( String word )
Returns the soundex code for the input word.
List
You will need a simple linked list of type String.
It needs to be ordered from low to high case insensitive ( use
compareToIgnoreCase for the comparisions ).
Tree
Each node in the tree will have a data field with is a String that is a
soundex code, and a List which is where the words matching that soundex
code get stored. The tree will be ordered by the soundex code.
- void InsertWord( String word )
This will insert a new word into the tree,
and create the node if the correct one does not exist.
Note: insert and InsertWord are different methods.
- get the soundex code for the word
- traverse to the node in the tree for that code
- if the node does not exist, create a new one for that code
don't forget to locate the node again
- insert the word in the list at that node
- List getList ( String word )
This needs to return a reference to the List of words that
have the same soundex code as the input word.
- get the soundex code for the word
- traverse to the node in the tree for that code
- if the node does exist return a pointer to the list
otherwise return a pointer to an empty List
running the spell checker
Once you have all the pieces done ( and tested ), you are ready to test
the spell checker. To do this you need the jar file with the driver in
it. Jar files are the java version of libraries. Here are the steps to
build and run the program using the jar file.
- copy the jar file
You need to put the jar in the same directory as your code.
This only needs to be done once.
cp ~jclark/bin/SpellMain.jar .
- build your classes
If you forget this you will get a NoClassDefFoundError exception.
Naming your classes incorrectly will cause the same exception.
- run the jar file
java -jar SpellMain.jar
- create an input file
The program can spell check any plain text file.
This program is worth 200 points.
It is due on August 13th.
Here is an example run.
Note : A spell checker is only as good as the dictionary,
some have far more words in them. The default one we are using
( /home/jclark/bin/words ) only has 45427 words in it.
The program will accept alternate dictionary files,
they are just plain text with one word per line.
Goals
- write tree code
- review linked lists
- use object composition
- integrate object-oriented code
- do specification programming