Skip to content

Instantly share code, notes, and snippets.

@hackerkid
Created February 20, 2017 17:07
Show Gist options
  • Save hackerkid/d76f8b1c464a9c736fab351e98a3613e to your computer and use it in GitHub Desktop.
Save hackerkid/d76f8b1c464a9c736fab351e98a3613e to your computer and use it in GitHub Desktop.
tfidf_body = TfidfVectorizer().fit_transform(bodies)
tfidf_headlines = TfidfVectorizer().fit_transform(headlines)
for i in range(0, 10):
cosine_similarities = linear_kernel(tfidf_headlines[i], tfidf_body[i]).flatten()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment