returns the likelihoods of observing the actual number coauthors shared 
    by c{p1} and c{p2}, conditioned on whether or not p1 and p2 are a match

def coauthor_likelihoods(p1, p2):
    """returns the likelihoods of observing the actual number coauthors shared 
    by c{p1} and c{p2}, conditioned on whether or not p1 and p2 are a match
    """
    def get_coauthors(p):
        ret = set()
        for m in p.mentions:
            for co_m in article_to_mentions[m.article_id]:
                if m != co_m:
                    co_p = Agglomerator.MENTION_TO_CLUSTER[co_m]
                    ret.add(co_p)
        return ret

    def num_common_coauthors(p1, p2):
        return len(set.intersection(get_coauthors(p1), get_coauthors(p2)))

    num_common = num_common_coauthors(p1, p2)
    if num_common >= len(config.p_coauthor[0]):
        num_common = len(config.p_coauthor[0]) - 1
    likelihood0 = config.p_coauthor[0][num_common]
    likelihood1 = config.p_coauthor[1][num_common]
    
    return likelihood1, likelihood0