All problems
ROUGE-L LCS Token Length
Problem
ROUGE-L is built on the longest common subsequence. Compute its length with dynamic programming over token sequences.
Given the candidate tokens and reference tokens, return the LCS length.
Hint
Match or skip at every cell of the DP table.
Test cases
case 1
in: [["a","b","c"],["a","c"]]
expected: 2
case 2
in: [["x","y"],["y","x"]]
expected: 1
case 3
in: [["p"],[]]
expected: 0
Starter codePython
def rouge_l_lcs_length(candidate, reference):
# Your code here
pass3 test cases · run your code against them in the editor