[Solved] Similarity between two text documents in Python


import numpy as np

from sklearn.feature_extraction.text import TfidfVectorizer

vect = TfidfVectorizer(min_df=1)

tfidf = vect.fit_transform(["My name is Ankit",
                             "Ankit name is very famous",
                             "Ankit like his name",
                             "India has a lot of beautiful cities"])

print ((tfidf * tfidf.T).A)

1

solved Similarity between two text documents in Python