1from spellchecker import SpellChecker
2
3spell = SpellChecker()
4
5# find those words that may be misspelled
6misspelled = spell.unknown(['something', 'is', 'hapenning', 'here'])
7
8for word in misspelled:
9 # Get the one `most likely` answer
10 print(spell.correction(word))
11
12 # Get a list of `likely` options
13 print(spell.candidates(word))
14
1from textblob import TextBlob
2
3data = "Natural language is a cantral part of our day to day life, and it's so antresting to work on any problem related to langages."
4
5output = TextBlob(data).correct()
6print(output)
7
1def edits1(word):
2 splits = [(word[:i], word[i:]) for i in range(len(word) + 1)]
3 deletes = [a + b[1:] for a, b in splits if b]
4 transposes = [a + b[1] + b[0] + b[2:] for a, b in splits if len(b)>1]
5 replaces = [a + c + b[1:] for a, b in splits for c in alphabet if b]
6 inserts = [a + c + b for a, b in splits for c in alphabet]
7 return set(deletes + transposes + replaces + inserts)
8