Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-237

chrF Lite (Character Bigram F1)

Problem

Compute character bigram precision, recall, and their F1 between pred and ref using multiset overlap. Return 0.0 when either string is too short to form a bigram or nothing matches. The beta weight is fixed at 1.

Test cases

case 1
in: ["hello","hello"]
expected: 1
case 2
in: ["hello","hallo"]
expected: 0.5
case 3
in: ["abc","xyz"]
expected: 0
case 4
in: ["ab","ab"]
expected: 1
Starter codePython
def chrf_lite(pred, ref):
    # Your code here
    pass

4 test cases · run your code against them in the editor