Due by 8:30AM Monday, April 27.
Hand in as: spellchecker.py
You may work with one partner on this assignment. In fact, I recommend it.
For this assignment, you will write a simple spell-checking program.
Once it is complete, here is what your program should do:
Print a list of words from the "filetocheck" file that are misspelled. Each misspelled word should be marked by the number of the line on which it appears.
For example, suppose filetocheck contains:
The moose anf the elk grazed peacefully in the meadow, unawere of the danger lurking in the darc of the foarest.
and wordlistfile has a reasonably complete collection of English words. Then your program should print:
Line 1: anf Line 3: unawere Line 4: darc Line 4: foarest
Note in particular that punctuation is ignored: "foarest" is reported without the period, and "meadow" is not reported, even though it has a comma attached to it.
No individual step in this program is complex beyond the sorts of things you have already written in Python. However, the program requires several steps, and thus you will need to plan your development carefully. We will discuss several aspects of this program in class on Wednesday, so spend some time thinking about the program beforehand.
Here's a brief outline of steps your program could take to complete the spell-checking task.
You can write the program one step at a time, testing each step after you have completed it. For example, after you have written code to perform step 1 above, you can simply print out the name of the word-list file and the name of the file-to-be-checked to make sure your program is getting the correct names. Then, after you have written the code for step 2, you can print out the list of acceptable words (for this test, you may wish to use a shorter word list than sowpods.txt). This sort of step-by-step "write a little code, then test it" approach is called "incremental development," and is a powerful way to gradually build complex systems out of simple pieces. More on this in class.
Have fun, and bring your questions to class, office hours, and Reid's prefect sessions.