Submission Date: 15th June 2001
Write a C++ program which maintains an internal dictionary of words. The program should use this dictionary of words to perform basic spell-checking on plain text files.
Your program should store its internal dictionary of words in a suitable data structure that facilitates fast insertion and searching.
These words should be loaded into the data structure from a data file called ‘dictionary’. This file should comprise a list of words, each of which is on a separate line.
The internal dictionary of words should be saved back to the dictionary data file upon program termination to reflect any amendments made.
Your program should allow the user to perform the following tasks-
· Add words to its internal dictionary
· Search for a word in the dictionary. The program should notify the user of search success or failure.
· Specify the filename of a plain text file for spell-checking
· The spell-checking process should include the following-
· Report any erroneous spellings (words in the text file not found in the internal dictionary) to the user.
· Allow the user to select whether each erroneous spelling should be added to the internal dictionary or ignored.
· Produce a final report on the screen. This final report should include-
· Number of word in the text file
· Number of erroneous spellings found
For extra marks you can add some of the following functionality to your program:
· Allow the user to delete words from the dictionary
· Output to screen / file a list of all words stored in the internal dictionary
· Add to the final report-
· Number of new words added to the internal dictionary
· Number of erroneous spellings not added to the internal dictionary
For bonus marks you could try to implement some of the following-
· Enable your program to create a corrected copy of the text file, called ‘<filename>_corrected’ where filename is the name of the text file being spell-checked. This would be identical to the original except wherever spelling mistakes were found, and a correction was supplied by the user, the word would be replaced.
· Add text file statistics to the final report-
· Total number of sentences / paragraphs
· Average characters per word
· Average words per sentence
· Average sentences per paragraph
· When erroneous spellings are found, get your program to suggest a ‘best guess’ alternative from its internal dictionary (hard!).
Create a directory called ‘cwk2’ within your ‘swe’ directory on UNIX. Within this directory place your source-code (.cpp) file and your executable program file.
These files will be collected from this directory automatically at 5:00 pm on 15th June 2001.
You can assume that the text files to be spell-checked are composed of alphanumeric text (letters, numbers punctuation). You need not account for any special formatting.
I will be testing you programs with my own dictionary and text files. Please do not leave your own dictionary files in your ‘cwk1’ directories.
You may assume, if you need to, that the internal dictionary will be no greater than 5,000 words in size, and that no words are more that 10 letters long.
Your program must compile and run under Unix. Be careful if developing with Windows based compilers - there may be some incompatibilities.