All problems
BLEU Brevity Penalty
Problem
Return the BLEU brevity penalty min(1, exp(1 - ref_len / hyp_len)).
Return 0.0 when hyp_len is 0.
Hint
The penalty only bites when the hypothesis is shorter than the reference.
Test cases
case 1
in: [10,10]
expected: 1
case 2
in: [5,10]
expected: 0.36787944117144233
case 3
in: [10,5]
expected: 1
case 4
in: [0,5]
expected: 0
case 5
in: [1,1]
expected: 1
Starter codePython
import math
def bleu_brevity_penalty(hyp_len, ref_len):
# Your code here
pass5 test cases · run your code against them in the editor