StringCompare
StringCompare copied to clipboard
Implement Jaccard similarity function in Python
Implement the Jaccard similarity function which, given two strings s
and t
, and given a Tokenizer instance tokens
, returns the jaccard similarity between tokens(s)
and tokens(t)
.
Here a tokenizer is a function which transforms a string into a set (or a multiset). The Jaccard similarity between two sets A and B is defined as |A and B|/|A or B|