* Ensure NER moves are available for single-word tokens

This commit is contained in:
Matthew Honnibal 2015-04-05 22:30:58 +02:00
parent a60a366b2c
commit 5a075ea3fc

View File

@ -76,8 +76,9 @@ cdef class BiluoPushDown(TransitionSystem):
for (raw_text, toks, (ids, words, tags, heads, labels, biluo)) in gold_tuples: for (raw_text, toks, (ids, words, tags, heads, labels, biluo)) in gold_tuples:
for i, ner_tag in enumerate(biluo): for i, ner_tag in enumerate(biluo):
if ner_tag != 'O' and ner_tag != '-': if ner_tag != 'O' and ner_tag != '-':
move_str, label = ner_tag.split('-') _, label = ner_tag.split('-')
move_labels[moves.index(move_str)][label] = True for move_str in ('B', 'I', 'L', 'U'):
move_labels[moves.index(move_str)][label] = True
return move_labels return move_labels
def move_name(self, int move, int label): def move_name(self, int move, int label):