数据结构第16次作业,hash表
Spellchecking
Prerequisites, Goals, and Outcomes
Prerequisites: Students should have mastered the following prerequisite skills.
• Hash Tables - Understanding of the concept of a recursive function
• Inheritance - Enhancing an existing data structure through specialization
Goals: This assignment is designed to reinforce the student's understanding of the use of hash tables as searchable containers.
Outcomes: Students successfully completing this assignment would master the following outcomes.
• Familiarize how to use hash tables, specifically hash sets
Background
Any word processing application will typically contain a spell check feature. Not only does this feature point out potentially misspelled words; it also suggests possible corrections.
Description
The program to be completed for this assessment is a spell checker. Below is a screen shot of the program in execution?
The program begins by opening a word list text file, specified by a command line parameter. The program outputs an error message and terminates if it cannot open the specified word list text file. A sample word list text file (wordlist.txt) is given in the supplied wordlist.zip archive. After successfully opening the specified word list text file, the program then stores each word into a hash table.
The program then opens a file to spell check. This user specifies this file through the command line. After opening this file, the program then compares each word in the file against the words stored in the hash table. The program considers a word to be misspelled if the word does not exist in the hash table. When this occurs, the program displays the line number the word appeared in, the word, and a list of possible corrections.
The list of possible corrections for a misspelled word is generated using a simple algorithm. Any variation of a misspelled word that is itself a word (i.e. it is found in the word list file) is a possible correction. Your solution to this asses
1