Question:
I am trying to use semantic matching in Python on a group of words.
Sample Input:
['error 1', '14_7error', 'err_87P', 'configuration 49-ñ', 'confi:p2g%']
Sample Output:
['error 1,14_7error,err_87P', 'configuration 49-ñ','confi:p2g%']
What I have tried:
I have tried using sklearn
, but can get it to work, code:
from sklearn.feature_extraction.text import TfidfVectorizer
documents = ['error 1', '14_7error', 'err_87P', 'configuration 49-ñ', 'confi:p2g%']
tfidf = TfidfVectorizer().fit_transform(documents)
pairwise_similarity = (tfidf * tfidf.T).toarray()
I have also looked at:
- Python: Semantic similarity score for Strings
- How to compute the similarity between two text documents?
But none of it has helped much.