句子中的拼写纠正

问题描述 投票:0回答:1

我使用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实现它如何找到拼写错误的单词并将其替换为原始文本,同时保留<< >>中的拼写错误单词

python regex spelling
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.