主题建模案例。因此,我已经将第一轮预处理的文本数据加载到文档术语矩阵中,但是查看dtm时,我意识到有像“aacc”、“aacct”、“aaccount”这样的单词,还有一些不同的变体,基本上就是指accounts。有没有办法把这几个单词的变体,意思是account换成account?我尝试了以下代码:
from spellchecker import SpellChecker
spell = SpellChecker()
# find those words that may be misspelled
misspelled = spell.unknown(['aacc'])
for word in misspelled:
# Get the one `most likely` answer
print(spell.correction(word))
# Get a list of `likely` options
print(spell.candidates(word))
但它实际上并没有给出一个“account”这个词的输出。这是一个有点棘手的,因为我正在寻找取代实际拼写错误的单词从字典和忽略其他单词,出现或似乎拼写错误,但只是参考代码
还试图删除句子字符串中的重复字符,例如“t上述a和areply t谢谢”
希望我说的够清楚,提前谢谢你
目前没有回答
相关问题 更多 >
编程相关推荐