(ref, hypo)
return final_scores
ref, dictionary of reference sentences (id, sentence)
    hypo, dictionary of hypothesis sentences (id, sentence)
    score, dictionary of scores
ref, dictionary of reference sentences (id, sentence)
    hypo, dictionary of hypothesis sentences (id, sentence)
    score, dictionary of scores
ref dictionary of reference sentences ( id sentence ) hypo dictionary of hypothesis sentences ( id sentence ) score dictionary of scores
def score(ref, hypo):
    """
    ref, dictionary of reference sentences (id, sentence)
    hypo, dictionary of hypothesis sentences (id, sentence)
    score, dictionary of scores
    """
    scorers = [
        (Bleu(4), ["Bleu_1", "Bleu_2", "Bleu_3", "Bleu_4"]),
        (Meteor(),"METEOR"),
        (Rouge(), "ROUGE_L"),
        (Cider(), "CIDEr")
    ]
    final_scores = {}
    for scorer, method in scorers:
        score, scores = scorer.compute_score(ref, hypo)
        if type(score) == list:
            for m, s in zip(method, score):
                final_scores[m] = s
        else:
            final_scores[method] = score
    return final_scores
def score ( ref , hypo ) : scorers = [ ( Bleu ( 4 ) , [ "Bleu_1" , "Bleu_2" , "Bleu_3" , "Bleu_4" ] ) , ( Meteor ( ) , "METEOR" ) , ( Rouge ( ) , "ROUGE_L" ) , ( Cider ( ) , "CIDEr" ) ] final_scores = { } for scorer , method in scorers : score , scores = scorer . compute_score ( ref , hypo ) if type ( score ) == list : for m , s in zip ( method , score ) : final_scores [ m ] = s else : final_scores [ method ] = score return final_scores