Fuzzy 和 FuzzyWuzzy:文本比较有什么区别?

数据挖掘 Python 相似 模糊逻辑
2022-03-12 06:49:08

我找到了很多关于模糊逻辑的信息,但关于模糊逻辑的信息较少。我想更多地了解这个,如果可能的话,确定逻辑的函数,并了解 Python 中的 partial_ratio 的作用。

任何信息都将受到欢迎。

1个回答

在源代码中,您可以找到模糊模糊中的部分比率的简单解释:

将最相似的子字符串的比率返回为 0 到 100 之间的数字

在此代码段中,您可以找到差异

from fuzzywuzzy import fuzz

fuzz.ratio("this is a test", "this is a test!")
Out:    97

fuzz.partial_ratio("this is a test", "this is a test!")
Out:    100

[1] https://github.com/seatgeek/fuzzywuzzy

[2] https://github.com/seatgeek/fuzzywuzzy/blob/master/fuzzywuzzy/fuzz.py