All problems
BLEU Brevity Penalty Value
Problem
The BLEU brevity penalty is 1 when the candidate is at least as long as the reference and exp(1 - reference_length / candidate_length) otherwise.
Given the candidate and reference lengths, return the penalty.
Hint
Short candidates are penalized exponentially.
Test cases
case 1
in: [10,10]
expected: 1
case 2
in: [5,10]
expected: 0.36787944117144233
case 3
in: [12,8]
expected: 1
Starter codePython
def bleu_brevity_penalty_value(candidate_length, reference_length):
# Your code here
pass3 test cases · run your code against them in the editor