How to use the sacrebleu.sentence_chrf 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 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
github pmichel31415 / teapot-nlp / teapot / scorers.py View on Github external
def score_sentence(self, hyp, ref, lang=None):
        return sacrebleu.sentence_chrf(hyp, ref)
github facebookresearch / vizseq / vizseq / scorers / chrf.py View on Github external
def _get_sent_chrf(
        hypothesis: List[str], references: List[List[str]],
        extra_args: Optional[Dict[str, str]] = None
):
    return [
        sb.sentence_chrf(h, r).score for h, r in zip(hypothesis, references[0])
    ]