C4_W1rouge1_similarity

Hi,

In the function rouge1_similarity, how do we calculate precision and recall?

Thanks.

Hi,

I am calculating precision and recall as

# get the precision
precision = overlap/len(ref_counter)

# get the recall
recall = overlap/len(sys_counter)

But I am passing 3 tests and failing 1. How can I resolve this?

Thanks.

Hi @vrathi

You should not get the len of ref_counter, but the length of the “system” (the model translation). Note that length of the counter would be smaller if there are duplicate words in a translated sentence.

Similarly, for the recall you should check against the length of the “reference” (the true translation). Also, the same “note” applies as in precision denominator.

Cheers