ROUGE-L scores summaries by their longest common subsequence of tokens with a reference. It rewards getting words in the right order without requiring them to be adjacent.
With LCS length , candidate length and reference length :
Tokenise by lowercasing and splitting on whitespace. Implement lcs_length(a, b) in time with memory, and rouge_l(candidate, reference) returning {"precision", "recall", "f1"}. Empty inputs give all zeros.