Horje
how can I corect word spelling by use of nltk? Code Example
how can I corect word spelling by use of nltk?
from spellchecker import SpellChecker

spell = SpellChecker()

# find those words that may be misspelled
misspelled = spell.unknown(['something', 'is', 'hapenning', 'here'])

for word in misspelled:
    # Get the one `most likely` answer
    print(spell.correction(word))

    # Get a list of `likely` options
    print(spell.candidates(word))
how can I corect word spelling by use of nltk?
from textblob import TextBlob
 
data = "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."
 
output = TextBlob(data).correct()
print(output)
how to remove misspelled words in nltk
def edits1(word):
   splits     = [(word[:i], word[i:]) for i in range(len(word) + 1)]
   deletes    = [a + b[1:] for a, b in splits if b]
   transposes = [a + b[1] + b[0] + b[2:] for a, b in splits if len(b)>1]
   replaces   = [a + c + b[1:] for a, b in splits for c in alphabet if b]
   inserts    = [a + c + b     for a, b in splits for c in alphabet]
   return set(deletes + transposes + replaces + inserts)




Python

Related
genrate random code in django Code Example genrate random code in django Code Example
string acharacters count in python without using len Code Example string acharacters count in python without using len Code Example
python add commas to list Code Example python add commas to list Code Example
how to display values on top of bar in barplot seaborn Code Example how to display values on top of bar in barplot seaborn Code Example
matplotlib despine Code Example matplotlib despine Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8