def merge_p(bi,p,bigrams):
    """
    Calculates the merge probability by combining the probs of the bigram of words and the prob of merge. 

    Arguments
    bi : bigram
    p  : p(MG->mg) from grammar (should be 1)
    
    Returns
    combined probability of merge op and bigram
    """
    (w1,w2)=bi
    return bigrams[w1][w2]*p