$30
Spell Checker - Prog 6 (20 points)
CECS 325 – System Programming with C++
Ode to the Spell Checker!
(https://www.thoughtco.com/spell-checker-poem-by-mark-eckman-1692348)
Eye halve a spelling cheque her
It came with my pea sea
It plainly marques four my revue
Miss steaks eye kin knot sea.
Eye strike a key and type a word
And weight four it two say
Weather eye am wrong oar write
It shows me strait a weigh.
As soon as a mist ache is maid
It nose bee fore two long
And eye can put the error rite
Its rare lea ever wrong.
Eye have run this poem threw it
I am shore your pleased two no
Its letter perfect awl the weigh
My cheque her tolled me sew.
Your assignment is to write a spell checker in C++. The program will read the dictionary and the target file from the command line. Then it will print all the misspelled words to the output screen, one word pre line, and immediately after each word you will show count of how many instances were in the target file
Example – suppose the dictionary contains these words:
hammer, nail, would, how, much, if, a, chuck, could, don’t, do, you
Suppose the words.txt file has these words:
How much wood would a “Woodchuck” chuck, if a Wood chuck could Chuck WOOD? Don’t know – do you…!?!?! You Can’t chuck wood.
Here’s the command from the command line
% spellChecker dictionary.txt words.txt
The output to the screen would be:
Misspelled words: (4)
can’t - 1
know - 1
wood – 4
woodchuck - 1
If you wanted to redirect the output to a file called words.out, you could do this:
% spellChecker dictionary.txt words.txt > words.out
Word Definition:
• A proper word must have at least one letter (use the 26 letters in the English alphabet) and may contain a hyphen or an apostrophe. No other characters are allowed.
• A word must start with a letter, and it can contain one or more hyphens (multi-thread), and it can have zero or one apostrophe (don’t)
• Capitalization is ignored (fred is the same as Fred)
• Punctuation is ignored (! ? )
• Double quotes are ignored (“hammer” is the same as hammer)
I have provided 2 text files for you to use. The American Dictionary and a book from the Gutenberg Press called Flatland.txt (https://www.gutenberg.org/cache/epub/201/pg201.txt )
When your program is run, the user must supply the dictionary file and the target file in the command line. If either are missing, the program will report an error, show what the command line should look like and terminate. When the program runs successfully, it will display the total count of words that were misspelled followed by the list of misspelled words and the count of each misspelled word (see above for an example). The misspelled words will be listed alphabetically.
What to submit:
Your source code for the spell checker.
A batch file (shell file) showing the command you used to run your program.
A screenshot of the first 20 lines of your output file. You can use head -20 to display that.