How do you suggest vocabulary entries for a misspelled label?
get_close_matches ranks candidate strings by similarity, applying a cutoff and a maximum result count.
Python example and interpretation
For imag, the vocabulary entry image can be suggested. Spelling similarity alone does not establish semantic equivalence, so approval belongs with the labeling policy or reviewer.
from difflib import get_close_matches
get_close_matches('imag',['image','audio','text'],n=1,cutoff=0.6)Result ['image']
中文
录入的标签拼错时,如何给审核人提供候选词?
get_close_matches 对候选字符串做相似匹配,按门槛与数量上限返回较接近的拼写。
Python 算例与适用条件
输入 imag,词表中 image 可成为建议。拼写接近并不表示标签含义一致,应由标注规则或审核人决定是否替换。
from difflib import get_close_matches
get_close_matches('imag',['image','audio','text'],n=1,cutoff=0.6)结果 ['image']