I have a typo detecting tool.
(我有一个错字检测工具。)
Here is my code:
(这是我的代码:)
from functools import partial
def x_in_y(word, inner):
return inner in word
wrong = ['mann','connaction','tee','rigt','putt']
sentence=['this mann is my son','the connaction is unstable','my tee is getting cold','put your hands down','rigt now','right behind my back']
for i in wrong:
print(f"Wrong: {i}")
filtered_names = filter(partial(x_in_y, inner=i), sentence)
for name in filtered_names:
print(name)
Output:
(输出:)
Wrong: mann
this mann is my son
Wrong: connaction
the connaction is unstable
Wrong: tee
my tee is getting cold
Wrong: rigt
rigt now
Wrong: putt
Although it could help me detect typo in labels(mann,connaction,tee....), but how could I add a correct word next to each labels?
(尽管它可以帮助我检测标签中的拼写错误(mann,connaction,tee ....),但是如何在每个标签旁边添加正确的单词?)
Like:
(喜欢:)
Wrong: mann "should be man"
this mann is my son
Wrong: connaction "should be connection"
the connaction is unstable
Wrong: tee "should be tea"
my tee is getting cold
Wrong: rigt "should be right"
rigt now
Wrong: putt
Also, I want
(我也要)
"Wrong:putt"
(“错:放”)
disappears if it doesn't really detect this kind of typo.
(如果没有真正检测到这种错字,则消失。)
How could I make it?
(我该怎么做?)
Please help (请帮忙)
ask by briiipo translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…