Answers for "how can I corect word spelling by use of nltk?"

0

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))
Posted by: Guest on November-13-2020
0

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)
Posted by: Guest on November-13-2020
0

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)
Posted by: Guest on October-05-2020

Python Answers by Framework

Browse Popular Code Answers by Language