核心功能 - 拼写修正
这个很棒的脚本将帮助你纠正你的文本单词拼写错误。你可以在下面找到脚本,将告诉你如何修复句子中的单个单词或多个单词。
实现代码
# Spell Fixer
# pip install textblob
from textblob import *
# Fixing Paragraph Spells
def fix_paragraph_words(paragraph):
sentence = TextBlob(paragraph)
correction = sentence.correct()
print(correction)
# Fixing Words Spells
def fix_word_spell(word):
word = Word(word)
correction = word.correct()
print(correction)
fix_paragraph_words("This is sammple tet!!")
fix_word_spell("maangoo")