CS340 Lab 8 - Spelling Corrector
Here is a short reading on
How to Write a Spelling
Corrector by Peter Norvig. I have made some slight modifications
to his code and you can get this at ~jillz/cs340/spellCorrect.py
Try out the spell corrector by using the correct
function on several words of your choice and see how it performs. Just
as in the reading, test out the accuracy by using spelltest on both tests1
and tests2. You can use spelltest(tests1, verbose=True) if you want to
see which words the corrector is failing on and how it is failing.
I have added a bias dictionary to to the code.
We can bias that a word is chosen by making the bias entry for that word
greater than 1 (or bias against the word if the entry is less than 1).
Suppose we hypothesize that more spelling errors can be corrected by
insertions than replacements, and that more errors can be corrected by
replacements over deletions. Modify the code to place in that bias and
test the hypothesis. Use tests1 for all your debugging and only use
tests2 at the end to check the hypothesis. What are your results?
Select another place to bias the corrector (changing a
letter to a double like s changed to ss, for example) and make the change
and test it out. What did you change and did it make things better or
worse?
Submit your modified code and a write-up on your results.