From b1c0253bb7aebd7590aa9d470144d5bcda00b482 Mon Sep 17 00:00:00 2001 From: maudehrmann Date: Wed, 4 May 2022 19:04:09 +0200 Subject: [PATCH] add IOBES test --- hipe_evaluation/tests/unittest_eval_2022.py | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/hipe_evaluation/tests/unittest_eval_2022.py b/hipe_evaluation/tests/unittest_eval_2022.py index 5b2227d..540ee48 100644 --- a/hipe_evaluation/tests/unittest_eval_2022.py +++ b/hipe_evaluation/tests/unittest_eval_2022.py @@ -87,6 +87,33 @@ def test_ner_lit_2_coarse(self): macro=False, ) + def test_ner_lit_2_coarse_iobes(self): + """ NER Test 2: + NE-COARSE-LIT: 2 entity in gold, 2 in system response. + (cf. scenario I) + """ + true_path = "hipe_evaluation/tests/data/unittest-ner-2-IOBES-true.tsv" + pred_path = true_path.replace("-true", "-pred") + eval_reference_path = pred_path + ".coarse-lit_ref_results.json" + evaluator: Evaluator = Evaluator( + true_path, + pred_path, + ) + self.assertEqual(evaluator.n_docs_true, 1, "Not all documents were parsed") + self.assertEqual(evaluator.n_lines_true, 1, "Not all layout lines were parsed") + self.assertEqual(evaluator.n_toks_true, 32, "Not all tokens were parsed") + + self._do_evaluation( + evaluator, + eval_reference_path, + column_name="NE-COARSE-LIT", + eval_type="nerc", + macro=False, + ) + + + + def test_ner_lit_2_nested(self): """ NER Test 2: NE-NESTED: 1 entity in gold (Hambourg as loc.adm.town), 0 in system response.