我使用https://norvig.com/spell-correct.html查找拼写错误
如何在一个句子中查找和替换拼写错误的单词。
到目前为止的努力:
sentences = "This sntence cntins errors. This sentence has to be corrcted."
list_string = sentences.split(' ')
for word in list_string:
print(correction(word))
输出:
this
sentence
contains
error
this
sentence
has
to
be
corrected.
预期产量:
This <<sntence>> sentence <<cntins>> contains errors. This sentence has to be <<corrcted>> corrected.
能够使用qazxsw poi实现它如何找到拼写错误的单词并将其替换为原始文本,同时保留<< >>中的拼写错误单词