diff --git a/spacy/syntax/ner.pyx b/spacy/syntax/ner.pyx index 73ef17534..488f16af9 100644 --- a/spacy/syntax/ner.pyx +++ b/spacy/syntax/ner.pyx @@ -84,9 +84,7 @@ cdef class BiluoPushDown(TransitionSystem): for (ids, words, tags, heads, labels, biluo), _ in sents: for i, ner_tag in enumerate(biluo): if ner_tag != 'O' and ner_tag != '-': - if ner_tag.count('-') != 1: - raise ValueError(ner_tag) - _, label = ner_tag.split('-') + _, label = ner_tag.split('-', 1) if label not in seen_entities: seen_entities.add(label) for move_str in ('B', 'I', 'L', 'U'): diff --git a/spacy/tests/regression/test_issue1967.py b/spacy/tests/regression/test_issue1967.py new file mode 100644 index 000000000..a6cd489cc --- /dev/null +++ b/spacy/tests/regression/test_issue1967.py @@ -0,0 +1,15 @@ +# coding: utf8 +from __future__ import unicode_literals + +import pytest + +from ...pipeline import EntityRecognizer +from ...vocab import Vocab + + +@pytest.mark.parametrize('label', ['U-JOB-NAME']) +def test_issue1967(label): + ner = EntityRecognizer(Vocab()) + entry = ([0], ['word'], ['tag'], [0], ['dep'], [label]) + gold_parses = [(None, [(entry, None)])] + ner.moves.get_actions(gold_parses=gold_parses)