All problems
ROUGE-2 Clipped Bigram Overlap
Problem
Return the number of clipped bigram matches between candidate and reference token lists. A bigram match consumes one occurrence in the reference, so repeated candidate bigrams cannot match more times than they appear in the reference.
Return 0 when either list has fewer than two tokens.
Hint
Count matches, not F1: each matched candidate bigram consumes one reference occurrence.
Test cases
case 1
in: [["a","b","c"],["a","b","c"]]
expected: 2
case 2
in: [["a","b","c"],["a","b","d"]]
expected: 1
case 3
in: [["a"],["a"]]
expected: 0
case 4
in: [["a","a","a"],["a","a"]]
expected: 1
case 5
in: [["x","y"],["a","b"]]
expected: 0
Starter codePython
def rouge2_overlap(candidate, reference):
# Your code here
pass5 test cases · run your code against them in the editor