Bite 185. Create a simple spelling suggester

In this Bite you will write a simple spelling corrector. Complete suggest_word that receives a misspelled word argument and returns the best matching alternative word based on similarity ratio.

We recommend using difflib.SequenceMatcher in combination with the provided word dictionary (loaded into words in the function).

Here are some example fixes for some common spelling mistakes:

>>> from spelling import suggest_word
>>> for misspelled_word in 'prfomnc abberration acommodation definately'.split():
...     print(misspelled_word, ' -> ', suggest_word(misspelled_word))
prfomnc  ->  'performance'
abberration  ->  'aberration'
acommodation  ->  'accommodation'
definately  ->  'definitely'

Pretty cool, no? Have fun, and keep calm and code in Python!

Will you be Pythonista #15 to crack this Bite?
It takes an average of ~14 minutes to solve this Bite (submissions 5-240 min).
Pythonistas rate this Bite 1.0 on a 1-10 difficulty scale.
» You can do it! 😌

Login and get coding
We use Python 3.7