Created
May 6, 2019 12:58
-
-
Save adsieg/f33430c62adf0185cbb1a176e3a3820b to your computer and use it in GitHub Desktop.
Jaccard Similarity
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 jaccard_similarity(query, document): | |
intersection = set(query).intersection(set(document)) | |
union = set(query).union(set(document)) | |
return len(intersection)/len(union) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment