CMPE 160 – INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
PROJECT #3
Due: 7.8.2005 Sunday at 12:00 PM
Spell Checker
In this project you are to develop a spell checker. A spell checker takes a text file as input and scans it for errors using a dictionary. Every single word is checked against the dictionary and if a word is not found it is replaced by the closest match. The new file is then saved.
Project Details:
Your spell checker will use an English word list of 100,000 words, which can be found here. The program will read the entire dictionary and store it in a binary search tree. Then it will prompt the user for the filename of the input text file. The input file will be read word by word and matched against the dictionary using binary search. If the word is found in the dictionary it will be left as it is. If the word does not exist in the library the lexicographically closest match will be found and the original word will be replaced by this new word. (Note that this isn’t a good method. If you use your own heuristic to find the closest match you may receive a bonus up to %20). For every such word your program should ask the user if the original word X should be replaced by the closest match Y. When the entire input file is read, the new file with corrections will be saved under a different name.
Remark:
The order of insertion of the words to the binary search tree must be different than the order they are listed in the dictionary file. In the dictionary, the words are listed in lexicographically ascending order and hence; if you follow the same order while creating the binary search tree, you will get an unbalanced and therefore useless tree. You may think of utilizing recursion in the BST creation process. Details will be explained in the problem session.
Report:
Write a report explaining your design and assumptions. Be compact and clear.
Implementation Details
NOTES: