def test_chrf_keep_whitespace(hypotheses, references, expected_score): score = sacrebleu.corpus_chrf(hypotheses, references, 6, 3, remove_whitespace=False) assert abs(score - expected_score) < EPSILON
def raw_corpus_chrf(hypotheses: Iterable[str], references: Iterable[str]) -> float: """ Simple wrapper around sacreBLEU's chrF implementation, without tokenization. :param hypotheses: Hypotheses stream. :param references: Reference stream. :return: chrF score as float between 0 and 1. """ return sacrebleu.corpus_chrf(hypotheses, references, order=sacrebleu.CHRF_ORDER, beta=sacrebleu.CHRF_BETA, remove_whitespace=sacrebleu.CHRF_REMOVE_WS)
def raw_corpus_chrf(hypotheses: Iterable[str], references: Iterable[str]) -> float: """ Simple wrapper around sacreBLEU's chrF implementation, without tokenization. :param hypotheses: Hypotheses stream. :param references: Reference stream. :return: chrF score as float between 0 and 1. """ return sacrebleu.corpus_chrf(hypotheses, references, order=sacrebleu.CHRF_ORDER, beta=sacrebleu.CHRF_BETA, remove_whitespace=True)
def test_chrf(hypotheses, references, expected_score): score = sacrebleu.corpus_chrf(hypotheses, references, 6, 3) assert abs(score - expected_score) < EPSILON