I'm trying a create a custom spell-check function with Textblob for sentence,were I'm unable to print whole corrected sentence
Input:
def spellcheck(sentence):
correct_sentence=[]
spell_check=TextBlob(sentence)
for words in spell_check.tokens:
corr_spelled=words.correct()
correct_sentence.append(corr_spelled)
query=" ".join(correct_sentence)
return query
Output:
spellcheck("what are is caled airoplance")
Answer:
what
Consider using the following:
from textblob import TextBlob
sentence = TextBlob(sentence)
correct_sentence = sentence.correct()
print(correct_sentence )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.