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
1.while循環的格式 while 條件: 條件滿足時,做的事情1 條件滿足時,做的事情2 條件滿足時,做的事情3 ...(省略)... demo