def fuzzy_fit(x, y):
"""
Returns whether x and y are similar in fuzzy string matching
:param x: the first mention
:param y: the second mention
:return: whether x and y are similar in fuzzy string matching
"""
if fuzz.ratio(x, y) >= 90:
return True
# Convert numbers to words
x_words = [num2words(int(w)).replace('-', ' ') if w.isdigit() else w for w in x.split()]
y_words = [num2words(int(w)).replace('-', ' ') if w.isdigit() else w for w in y.split()]
return fuzz.ratio(' '.join(x_words), ' '.join(y_words)) >= 85
评论列表
文章目录