python 比较文本获得相似度

利用python内置模块difflib

from difflib import SequenceMatcher

def Compare(str1, str2):
s = SequenceMatcher(None, str1, str2).ratio()
return s
最后修改:2022 年 05 月 18 日
如果觉得我的文章对你有用,请随意赞赏