From 8c354c432bbe94bed59da9a8decd45336bae89ba Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 10 Apr 2015 04:59:59 +0200 Subject: [PATCH] * Add ValueError condition to ner_tag reading --- spacy/syntax/ner.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spacy/syntax/ner.pyx b/spacy/syntax/ner.pyx index c2597bc7e..0a40ed9a8 100644 --- a/spacy/syntax/ner.pyx +++ b/spacy/syntax/ner.pyx @@ -76,6 +76,8 @@ cdef class BiluoPushDown(TransitionSystem): for (raw_text, toks, (ids, words, tags, heads, labels, biluo)) in gold_tuples: 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('-') for move_str in ('B', 'I', 'L', 'U'): move_labels[moves.index(move_str)][label] = True