DEV Community

NirmalSankalana
NirmalSankalana

Posted on

Answer: NLP: any easy and good methods to find semantic similarity between words?

One effective approach for determining semantic similarity between two texts involves utilizing word embeddings along with cosine similarity. The Sentence Transformers Python framework provides transformers which gives state-of-art word embeddings specifically designed for this purpose. Below is an example code:

import sentence_transformers
from sklearn.metrics.pairwise import cosine_similarity
model_name = 'all-mpnet-base-v2'

#

Top comments (0)