Skip to content

Commit c446c9c

Browse files
committed
sacrebleu.py: applied signature changes in the sacrebleu dependency
1 parent 9887447 commit c446c9c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

neuralmonkey/evaluators/sacrebleu.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class SacreBLEUEvaluator(Evaluator[List[str]]):
1313

1414
def __init__(self,
1515
name: str,
16-
smooth: str = "exp",
17-
smooth_floor: float = 0.0,
16+
smooth_method: str = "exp",
17+
smooth_value: float = 0.0,
1818
force: bool = False,
1919
lowercase: bool = False,
2020
tokenize: str = "none",
@@ -27,13 +27,14 @@ def __init__(self,
2727
"Unknown tokenizer '{}'. You must use one of sacrebleu's "
2828
"tokenizers: {}".format(tokenize, str(TOKENIZERS)))
2929

30-
if smooth not in SMOOTH_VARIANTS:
30+
if smooth_method not in SMOOTH_VARIANTS:
3131
raise ValueError(
3232
"Unknown smoothing '{}'. You must use one of sacrebleu's "
33-
"smoothing methods: {}".format(smooth, str(SMOOTH_VARIANTS)))
33+
"smoothing methods: {}".format(smooth_method,
34+
str(SMOOTH_VARIANTS)))
3435

35-
self.smooth = smooth
36-
self.smooth_floor = smooth_floor
36+
self.smooth_method = smooth_method
37+
self.smooth_value = smooth_value
3738
self.force = force
3839
self.lowercase = lowercase
3940
self.tokenize = tokenize
@@ -48,8 +49,8 @@ def score_batch(self,
4849
ref_joined = [" ".join(ref) for ref in references]
4950

5051
bleu = corpus_bleu(hyp_joined, [ref_joined],
51-
smooth=self.smooth,
52-
smooth_floor=self.smooth_floor,
52+
smooth_method=self.smooth_method,
53+
smooth_value=self.smooth_value,
5354
force=self.force,
5455
lowercase=self.lowercase,
5556
tokenize=self.tokenize,

0 commit comments

Comments
 (0)