How to use pyspellchecker library In Python
You can install this library as below:
Using pip:
pip install pyspellchecker
In Jupyter Notebook:
Python3
import sys !{sys.executable} - m pip install pyspellchecker |
Spelling Checker program using pyspellchecker –
Python3
from spellchecker import SpellChecker spell = SpellChecker() # find those words that may be misspelled misspelled = spell.unknown([ "cmputr" , "watr" , "study" , "wrte" ]) for word in misspelled: # Get the one `most likely` answer print (spell.correction(word)) # Get a list of `likely` options print (spell.candidates(word)) |
Output:
computer {'caput', 'caputs', 'compute', 'computor', 'impute', 'computer'} water {'water', 'watt', 'warr', 'wart', 'war', 'wath', 'wat'} write {'wroe', 'arte', 'wre', 'rte', 'wrote', 'write'}
Spelling checker in Python
For any type of text processing or analysis, checking the spelling of the word is one of the basic requirements. This article discusses various ways that you can check the spellings of the words and also can correct the spelling of the respective word.