From 54a978e63e00060553b34169217eb29edc313153 Mon Sep 17 00:00:00 2001 From: huyingxi <531196781@qq.com> Date: Sat, 30 Dec 2017 23:22:35 +0800 Subject: [PATCH] Update __init__.py update similarity_distance weights --- synonyms/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synonyms/__init__.py b/synonyms/__init__.py index c72a4a1..bbb92eb 100755 --- a/synonyms/__init__.py +++ b/synonyms/__init__.py @@ -219,8 +219,8 @@ def _similarity_distance(s1, s2): # https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.linalg.norm.html g = 1 / (np.linalg.norm(a - b) + 1) u = _levenshtein_distance(s1, s2) - r = g * 1.4 + u * 0.2 - r = min((r * 10 + 0.1), 1.0) + r = g * 1.8 + u * 0.4 + r = min((r * 18), 1.0) return float("%.3f" % r)