Code QuizIntermediate Jaccard Similarity on Token Sets
Find the wrong denominator in this Jaccard calculation.
Codepython
def jaccard(a, b):
set_a = set(a)
set_b = set(b)
intersection = set_a & set_b
union = set_a | set_b
return len(intersection) / len(set_a)
print(jaccard(["the", "cat"], ["the", "dog"]))What is the bug in this Jaccard similarity function?