def jaccard_index(a, b):
    """
    Jaccard similarity of sets a and b
    """
    intsize = len(set.intersection(a, b))
    unionsize = len(set.union(a, b))
    if unionsize == 0:
        return 1
    else:
        return float(intsize) / float(unionsize)