(seq1: Iterable[str], seq2: Iterable[str])
Measure the similarity between two sequences of strings as sets
    using the Otsuka-Ochiai variation of cosine similarity (which is equivalent
    to the usual formulation when values are binary).

    Args:
        seq1
        seq2

    Returns:
        Similarity between ``seq1`` and ``seq2`` in the interval [0.0, 1.0],
        where larger values correspond to more similar sequences

    Reference:
        https://en.wikipedia.org/wiki/Cosine_similarity#Otsuka-Ochiai_coefficient
Measure the similarity between two sequences of strings as sets
    using the Otsuka-Ochiai variation of cosine similarity (which is equivalent
    to the usual formulation when values are binary).
Measure the similarity between two sequences of strings as sets using the Otsuka - Ochiai variation of cosine similarity ( which is equivalent to the usual formulation when values are binary ) .
def cosine(seq1: Iterable[str], seq2: Iterable[str]) -> float:
    """
    Measure the similarity between two sequences of strings as sets
    using the Otsuka-Ochiai variation of cosine similarity (which is equivalent
    to the usual formulation when values are binary).

    Args:
        seq1
        seq2

    Returns:
        Similarity between ``seq1`` and ``seq2`` in the interval [0.0, 1.0],
        where larger values correspond to more similar sequences

    Reference:
        https://en.wikipedia.org/wiki/Cosine_similarity#Otsuka-Ochiai_coefficient
    """
    set1 = set(seq1)
    set2 = set(seq2)
    try:
        return len(set1 & set2) / math.sqrt(len(set1) * len(set2))
    except ZeroDivisionError:
        return 0.0
def cosine ( seq1 : Iterable [ str ] , seq2 : Iterable [ str ] ) -> float : set1 = set ( seq1 ) set2 = set ( seq2 ) try : return len ( set1 & set2 ) / math . sqrt ( len ( set1 ) * len ( set2 ) ) except ZeroDivisionError : return 0.0