def test_esnli_metric_multiple_explanations(self): ref = "this is a string" ref2 = "this is another string" self.assertDictClose( metrics.esnli_metric([{ "label": 0, "explanations": [ref, ""] }, { "label": 1, "explanations": ["", ref] }, { "label": 2, "explanations": ["", ref2] }], [{ "label": 0, "explanations": [ref] }, { "label": 1, "explanations": [ref] }, { "label": 2, "explanations": [ref2] }]), { "accuracy": 100., "bleu": 100., "expln1_length": 16 })
def test_esnli_metric_multiple_predicted_explanations(self): ref = "this is a string" self.assertDictClose( metrics.esnli_metric( [{ "label": 0, "explanations": [ref, ""] }], [{ "label": 0, "explanations": [ref, ref] }], ), { "accuracy": 100., "bleu": 100., "expln1_length": 16 })