Data Science, Machine Learning.
CountVectorizer(stop_words=company_name_stopwords) vocabulary = vect.fit(a + b).vocabulary_ tfidf_vect = TfidfVectorizer(stop_words=company_name_stopwords, vocabulary=vocabulary) a_mat = tfidf_vect.fit_transform(a) b_mat = tfidf_vect.fit_transform(b) cosimilarities = cosine_similarity(a_mat, b_mat)