Created
October 3, 2022 08:59
-
-
Save andrea-dagostino/e1f23b8d10340feb7b2c0f61455f3fc7 to your computer and use it in GitHub Desktop.
text_sim_tfidf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def compute_similarity(a, b): | |
| tfidf = vectorizer.fit_transform([a, b]) | |
| return ((tfidf * tfidf.T).toarray())[0,1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment