mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-27 02:16:32 +03:00
Fix action collection for parser
This commit is contained in:
parent
8d1e64be69
commit
1d5d9838a2
|
@ -324,10 +324,12 @@ cdef class ArcEager(TransitionSystem):
|
||||||
if label.upper() != 'ROOT':
|
if label.upper() != 'ROOT':
|
||||||
if (LEFT, label) not in seen_actions:
|
if (LEFT, label) not in seen_actions:
|
||||||
actions[LEFT].append(label)
|
actions[LEFT].append(label)
|
||||||
|
seen_actions.add((LEFT, label))
|
||||||
for label in kwargs.get('right_labels', []):
|
for label in kwargs.get('right_labels', []):
|
||||||
if label.upper() != 'ROOT':
|
if label.upper() != 'ROOT':
|
||||||
if (RIGHT, label) not in seen_actions:
|
if (RIGHT, label) not in seen_actions:
|
||||||
actions[RIGHT].append(label)
|
actions[RIGHT].append(label)
|
||||||
|
seen_actions.add((RIGHT, label))
|
||||||
|
|
||||||
for raw_text, sents in kwargs.get('gold_parses', []):
|
for raw_text, sents in kwargs.get('gold_parses', []):
|
||||||
for (ids, words, tags, heads, labels, iob), ctnts in sents:
|
for (ids, words, tags, heads, labels, iob), ctnts in sents:
|
||||||
|
@ -338,9 +340,11 @@ cdef class ArcEager(TransitionSystem):
|
||||||
if head < child:
|
if head < child:
|
||||||
if (RIGHT, label) not in seen_actions:
|
if (RIGHT, label) not in seen_actions:
|
||||||
actions[RIGHT].append(label)
|
actions[RIGHT].append(label)
|
||||||
|
seen_actions.add((RIGHT, label))
|
||||||
elif head > child:
|
elif head > child:
|
||||||
if (LEFT, label) not in seen_actions:
|
if (LEFT, label) not in seen_actions:
|
||||||
actions[LEFT].append(label)
|
actions[LEFT].append(label)
|
||||||
|
seen_actions.add((LEFT, label))
|
||||||
return actions
|
return actions
|
||||||
|
|
||||||
property action_types:
|
property action_types:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user