Skip to content
Snippets Groups Projects
Commit 21fc63db authored by Manon Blanco's avatar Manon Blanco
Browse files

Support empty lines in BIO parser

parent 6de3c94d
No related branches found
No related tags found
1 merge request!46Support empty lines in BIO parser
Pipeline #157322 passed
......@@ -72,6 +72,9 @@ def parse_bio(lines: List[str]) -> dict:
containing_tag = None
for index, line in enumerate(lines):
if not line:
continue
word, label = parse_line(index, line)
# Preserve hyphens to avoid confusion with the hyphens added later during alignment
......
......@@ -10,6 +10,11 @@ def fake_annot_bio():
return FIXTURES / "test_annot.bio"
@pytest.fixture()
def fake_annot_with_empty_lines_bio():
return FIXTURES / "test_annot_with_empty_lines.bio"
@pytest.fixture()
def fake_predict_bio():
return FIXTURES / "test_predict.bio"
......
Gérard B-PER
de I-PER
Nerval I-PER
was O
born O
in O
Paris B-LOC
in O
1808 B-DAT
. O
......@@ -175,6 +175,7 @@ expected_parsed_end_of_file = {
(pytest.lazy_fixture("fake_annot_bio"), expected_parsed_annot),
(pytest.lazy_fixture("fake_predict_bio"), expected_parsed_predict),
(pytest.lazy_fixture("empty_bio"), None),
(pytest.lazy_fixture("fake_annot_with_empty_lines_bio"), expected_parsed_annot),
(pytest.lazy_fixture("bioeslu_bio"), expected_parsed_annot),
(pytest.lazy_fixture("end_of_file_bio"), expected_parsed_end_of_file),
],
......
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