svjack's picture
Update synonyms.py
b337b8f
raw
history blame
280 Bytes
import pandas as pd
from sentence_transformers import SentenceTransformer
cmp_model = SentenceTransformer('uer/sbert-base-chinese-nli')
def compare(text0, text1):
embeddings = cmp_model.encode([text0, text1])
return int(pd.DataFrame(embeddings.T).corr().iloc[0, 1] * 100)