how can i corect word spelling by use of nltk 3f

Solutions on MaxInterview for how can i corect word spelling by use of nltk 3f by the best coders in the world

showing results for - "how can i corect word spelling by use of nltk 3f"
Alban
12 Jan 2017
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
Dylan
27 Jan 2018
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
Matteo
04 Aug 2020
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