def normalize(hypotheses, index=-1):
    """Normalize probabilities."""
    total = 0
    for probs in hypotheses.values():
        total += probs[index]
    for probs in hypotheses.values():
        probs[index] /= total

    return total