We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0f35101 commit c89d62eCopy full SHA for c89d62e
sacrebleu/metrics/bleu.py
@@ -245,13 +245,12 @@ def compute_bleu(correct: List[int],
245
smooth_value = BLEU.SMOOTH_DEFAULTS[smooth_method]
246
247
# Compute brevity penalty
248
+ bp = 1.0
249
if sys_len < ref_len:
- bp = math.exp(1 - ref_len / sys_len) if sys_len > 0 else 0.0
250
- else:
251
- bp = 1.0
+ bp = math.exp(1 - ref_len / sys_len) if sys_len > 0 else 0.0
252
253
# n-gram precisions
254
- precisions = [0.0 for x in range(max_ngram_order)]
+ precisions = [0.0] * max_ngram_order
255
256
# Early stop if there are no matches (#141)
257
if not any(correct):
0 commit comments