Skip to content
Snippets Groups Projects
Commit 0a216a31 authored by Blanche Miret's avatar Blanche Miret
Browse files

Add test for entity boundaries

parent b2db7c00
No related branches found
No related tags found
1 merge request!5Correct research of predicted entity beginning
Pipeline #103799 passed
......@@ -143,6 +143,78 @@ expected_matches = {"All": 1, "PER": 1, "LOC": 0, "DAT": 0}
expected_matches_nested_perfect = {"All": 3, "PER": 1, "LOC": 2}
expected_matches_nested_false = {"All": 2, "PER": 1, "LOC": 1}
fake_annot_backtrack_boundary = "The red dragon"
fake_annot_tags_bk_boundary = [
"O",
"O",
"O",
"O",
"B-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
]
fake_predict_tags_bk_boundary = [
"B-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
]
expected_matches_bk_boundary = {"All": 0, "PER": 0}
fake_annot_backtrack_boundary_2 = "A red dragon"
fake_annot_tags_bk_boundary_2 = [
"O",
"O",
"B-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
]
fake_predict_tags_bk_boundary_2 = [
"B-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
"I-PER",
]
expected_matches_bk_boundary_2 = {"All": 1, "PER": 1}
@pytest.mark.parametrize(
"test_input, expected",
......@@ -174,6 +246,24 @@ expected_matches_nested_false = {"All": 2, "PER": 1, "LOC": 1}
),
expected_matches_nested_false,
),
(
(
fake_annot_backtrack_boundary,
fake_annot_backtrack_boundary,
fake_annot_tags_bk_boundary,
fake_predict_tags_bk_boundary,
),
expected_matches_bk_boundary,
),
(
(
fake_annot_backtrack_boundary_2,
fake_annot_backtrack_boundary_2,
fake_annot_tags_bk_boundary_2,
fake_predict_tags_bk_boundary_2,
),
expected_matches_bk_boundary_2,
),
],
)
def test_compute_matches(test_input, expected):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment