from typing import Counter


def bag_jaccard(x, y):
    """
    Jaccard similarity measure between two multisets (bags)
    :param x: list of words (strings) for the first sentence
    :param y: list of words (strings) for the second sentence
    :return: similarity score between two sentences
    """
    if len(x) == 0 or len(y) == 0:
        return 0.0

    xc = Counter(x)
    yc = Counter(y)
    inter = xc & yc
    union = xc | yc
    return len(list(inter.elements())) / len(list(union.elements()))