📜  检查字符串相似度python代码示例

📅  最后修改于: 2022-03-11 14:47:05.826000             🧑  作者: Mango

代码示例2
def similar(w1, w2):
    w1 = w1 + ' ' * (len(w2) - len(w1))
    w2 = w2 + ' ' * (len(w1) - len(w2))
    return sum(1 if i == j else 0 for i, j in zip(w1, w2)) / float(len(w1))