Bite 185. Create a simple spelling suggester
Login and get codingIn this Bite you will write a simple spelling corrector. Complete
suggest_wordthat receives a misspelled word argument and returns the best matching alternative word based on similarity ratio.We recommend using
difflib.SequenceMatcherin combination with the provided word dictionary (loaded intowordsin 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 the 110th person to crack this Bite?
Resolution time: ~33 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 3.12 on a 1-10 difficulty scale.
» You can do it! 😌