Skip to content

Commit

Permalink
Merge pull request #99 from martinpopel/fix-sentence-bleu-docstring
Browse files Browse the repository at this point in the history
sentence_score needs a list of references, not a single string
  • Loading branch information
martinpopel authored Jul 29, 2020
2 parents 6e663d6 + 568fd7f commit b4864c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sacrebleu/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def sentence_bleu(hypothesis: str,
BLEU is a corpus-level metric.
:param hypothesis: Hypothesis string.
:param reference: Reference string.
:param references: List of reference strings.
:param smooth_method: The smoothing method to use
:param smooth_value: For 'floor' smoothing, the floor value to use.
:param use_effective_order: Account for references that are shorter than the largest n-gram.
Expand Down
3 changes: 2 additions & 1 deletion sacrebleu/metrics/bleu.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,11 @@ def sentence_score(self, hypothesis: str,
BLEU is a corpus-level metric.
:param hypothesis: Hypothesis string.
:param reference: Reference string.
:param references: List of reference strings.
:param use_effective_order: Account for references that are shorter than the largest n-gram.
:return: a `BLEUScore` object containing everything you'd want
"""
assert not isinstance(references, str), "sentence_score needs a list of references, not a single string"
return self.corpus_score(hypothesis, [[ref] for ref in references],
use_effective_order=use_effective_order)

Expand Down

0 comments on commit b4864c3

Please sign in to comment.