All problems
chrF-lite Character F-score
Problem
Return the character unigram F1 between candidate and reference strings. Count clipped per-character matches, then F1 = 2PR/(P+R) with precision = matches / len(candidate) and recall = matches / len(reference).
Return 0.0 when both strings are empty or there are no matches.
Hint
Characters are matched with clipping, exactly like a bag-of-words F-score.
Test cases
case 1
in: ["abc","abc"]
expected: 1
case 2
in: ["abc","abd"]
expected: 0.6666666666666666
case 3
in: ["ab","a"]
expected: 0.6666666666666666
case 4
in: ["abc","xyz"]
expected: 0
case 5
in: ["aab","ab"]
expected: 0.8
Starter codePython
def chrf_lite(candidate, reference):
# Your code here
pass5 test cases · run your code against them in the editor