def muc(gold_mentions, response_mentions):
    """
    M. Vilain, J. Burger, J. Aberdeen, D. Connolly, and L. Hirschman. 1995.
    A model theoretic coreference scoring scheme. In MUC-6.
    https://www.aclweb.org/anthology/M/M95/M95-1005.pdf

    The MUC measure focuses on the links (pairs of mentions) and computes recall and precision scores for each link.
    The recall is the number of common links between entities in K and R divided by the number of links in K.
    The precision is the number of common links between entities in K and R divided by the number of links in R.
    :param gold_mentions: a set of key entities, with each entity comprising one or more mentions
    :param response_mentions: a set of response entities, with each entity comprising one or more mentions
    :return: The F1 score computed by MUC
    """
    gold_links = set([(x, y) for entity in gold_mentions for x in entity for y in entity if x != y])
    response_links = set([(x, y) for entity in response_mentions for x in entity for y in entity if x != y])

    # No links - both annotators decided to separate all mentions to different clusters
    if len(gold_links) == 0 and len(response_links) == 0:
        return 1.00

    intersection = gold_links.intersection(response_links)
    recall = len(intersection) / (1.0 * len(gold_links)) if len(gold_links) > 0 else 0.0
    precision = len(intersection) / (1.0 * len(response_links)) if len(response_links) > 0 else 0.0

    f1 = 2 * (precision * recall) / (precision + recall) if (precision + recall) > 0 else 0.0

    return f1