def test_bleu_eval(self):
    """Tests whether we are seeing the expected BLEU score."""
    input_path = self._get_abs_path("sample/dev_sample.jsonl")
    references = self._format_refs(input_path)
    # Sacrebleu expects dimension transpose (1 list per reference count).
    references_sacrebleu = [list(x) for x in zip(*references)]
    output_path = self._get_abs_path("sample/output_sample.txt")
    with open(output_path, "r", encoding="utf-8") as f:
      predictions = [p.strip().lower() for p in f]

    expected_bleu = 45.5
    bleu = sacrebleu.corpus_bleu(predictions, references_sacrebleu)
    assert round(bleu.score, 1) == expected_bleu
Tests whether we are seeing the expected BLEU score.
language/totto/eval_pipeline_test.py