1.安装包
pip install python-Levenshtein
2.demo
import Levenshtein
a='abc'
b='abcd'
wer=Levenshtein.distance(a,b)/len(a)
corr=(1-wer)
print(corr)
result:
0.6666666666666667
Process finished with exit code 0
1.安装包
pip install python-Levenshtein
2.demo
import Levenshtein
a='abc'
b='abcd'
wer=Levenshtein.distance(a,b)/len(a)
corr=(1-wer)
print(corr)
result:
0.6666666666666667
Process finished with exit code 0