* Fix bug in ArcEager.get_labels

This commit is contained in:
Matthew Honnibal 2015-03-27 15:21:06 +01:00
parent cd054c6c9f
commit b32f581acb
1 changed files with 3 additions and 3 deletions

View File

@ -45,11 +45,11 @@ cdef class ArcEager(TransitionSystem):
move_labels = {SHIFT: {'': True}, REDUCE: {'': True}, RIGHT: {}, move_labels = {SHIFT: {'': True}, REDUCE: {'': True}, RIGHT: {},
LEFT: {}, BREAK: {'ROOT': True}} LEFT: {}, BREAK: {'ROOT': True}}
for raw_text, segmented, (ids, words, tags, heads, labels, iob) in gold_parses: for raw_text, segmented, (ids, words, tags, heads, labels, iob) in gold_parses:
for i, (head, label) in enumerate(zip(heads, labels)): for child, head, label in zip(ids, heads, labels):
if label != 'ROOT': if label != 'ROOT':
if head > i: if head < child:
move_labels[RIGHT][label] = True move_labels[RIGHT][label] = True
elif head < i: elif head > child:
move_labels[LEFT][label] = True move_labels[LEFT][label] = True
return move_labels return move_labels