Skip to content
Snippets Groups Projects
Commit 68c87931 authored by Yoann Schneider's avatar Yoann Schneider :tennis:
Browse files

Allow - in labels again

parent 032c2267
No related branches found
No related tags found
1 merge request!26Allow - in labels again
Pipeline #127550 passed
......@@ -45,11 +45,7 @@ def parse_line(index: int, line: str, path: Path):
assert match_iob
word, label = match_iob.group(1, 2)
# We should have either one - (BLIU-) or none at all (O)
assert label.count("-") <= 1
return word, label
return match_iob.group(1, 2)
except AssertionError:
raise (
Exception(
......
......@@ -200,6 +200,7 @@ def test_parse_bio_no_input():
("Hi B-ORG", "Hi", "B-ORG"),
("Hi B-Org or maybe not org", "Hi", "B-Org or maybe not org"),
("1258 B-Date et Lieu", "1258", "B-Date et Lieu"),
("Devoti B-Sous-titre", "Devoti", "B-Sous-titre"),
),
)
def test_parse_line(line, word, label):
......@@ -208,7 +209,7 @@ def test_parse_line(line, word, label):
@pytest.mark.parametrize(
"line",
(("HiB-ORG"), ("HiB-ORG or maybe not"), ("Hello B-surname and L-ocation")),
(("HiB-ORG"), ("HiB-ORG or maybe not")),
)
def test_parse_line_crash(line):
with pytest.raises(Exception):
......@@ -221,6 +222,7 @@ def test_parse_line_crash(line):
("B-ORG", "ORG"),
("B-Date et Lieu", "Date et Lieu"),
("I-Date et Lieu", "Date et Lieu"),
("B-Sous-titre", "Sous-titre"),
),
)
def test_get_type_label(label, expected_type):
......
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