Project 5 - A Spell Checker

Due - Thursday, May 17, 2007

The goal of this project is to give you more experience with trees. For this project, you will write a spell checker. Your program will read from a file a dictionary of words and store them in a Binary Search Tree (BST). You will be responsible for building the BST. Next, you will open a text file containing the text to be spell checked. For each word in the file, you will determine whether it exists in the BST. If so, you will assume the word is spelled correctly. If not, you will provide the user with several choices for a replacement using the algorithm below. The user can either select one of the choices you provide, or enter a new word. If the user chooses to enter a new word, you must spell check that word as well. When your program has checked the entire document, you will save the corrected text to the original file.

For full credit, your BST will support (at least) the methods insert, delete, and find. Note that you need to support delete even though you may not use it for this particular application.

The spell check algorithm you will use will work as follows. You will use all of the strategies listed below to modify the original, misspelled word. For each modified word, you will determine whether it exists in the dictionary. If so, you will provide the modified word as a choice. Download and use the dictionary available here OR the this dictionary . For full credit on this assignment, you must come up with a strategy for avoiding a running time of O(N) for the find operation. Hint: you do not want to insert elements into a BST in sorted order.

Due 5:00PM, Thursday May 17, 2007

  1. Complete and submit your working code. Turn in a hard copy in class and place a copy of your .java files in /home/submit/cs112-s07/username.
  2. Make sure that each function is well documented. Your documentation should specify the type and function of the input parameters and output.
  3. Run your program on a variety of inputs ensuring that all error conditions are handled correctly.
Note: No portion of your code may be copied from any other source including another text book, a web page, or another student (current or former). You must provide citations for any sources you have used in designing and implementing your program.
Sami Rollins