How to use the sacrebleu.sentence_bleu function in sacrebleu

To help you get started, we’ve selected a few sacrebleu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pmichel31415 / teapot-nlp / teapot / scorers.py View on Github external
def score_sentence(self, hyp, ref, lang=None):
        return sacrebleu.sentence_bleu(hyp, ref, smooth_value=0.01) / 100
github awslabs / sockeye / sockeye / rerank.py View on Github external
def __init__(self, metric: str,
                 return_score: bool = False) -> None:
        if metric == C.RERANK_BLEU:
            self.scoring_function = sacrebleu.sentence_bleu
        elif metric == C.RERANK_CHRF:
            self.scoring_function = sacrebleu.sentence_chrf
        else:
            raise utils.SockeyeError("Scoring metric '%s' unknown. Choices are: %s" % (metric, C.RERANK_METRICS))

        self.return_score = return_score