Update synonyms.py
Browse files- synonyms.py +3 -1
synonyms.py
CHANGED
@@ -1,12 +1,14 @@
|
|
1 |
-
import rapidfuzz
|
2 |
|
3 |
import pandas as pd
|
4 |
from sentence_transformers import SentenceTransformer
|
5 |
cmp_model = SentenceTransformer('uer/sbert-base-chinese-nli')
|
6 |
|
7 |
def compare(text0, text1):
|
|
|
8 |
val = rapidfuzz.fuzz.ratio(text0, text1)
|
9 |
if val >= 75:
|
10 |
return val
|
|
|
11 |
embeddings = cmp_model.encode([text0, text1])
|
12 |
return int(pd.DataFrame(embeddings.T).corr().iloc[0, 1] * 100)
|
|
|
1 |
+
#import rapidfuzz
|
2 |
|
3 |
import pandas as pd
|
4 |
from sentence_transformers import SentenceTransformer
|
5 |
cmp_model = SentenceTransformer('uer/sbert-base-chinese-nli')
|
6 |
|
7 |
def compare(text0, text1):
|
8 |
+
'''
|
9 |
val = rapidfuzz.fuzz.ratio(text0, text1)
|
10 |
if val >= 75:
|
11 |
return val
|
12 |
+
'''
|
13 |
embeddings = cmp_model.encode([text0, text1])
|
14 |
return int(pd.DataFrame(embeddings.T).corr().iloc[0, 1] * 100)
|