mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-25 00:34:20 +03:00
* Add iterators to the NER and parser transition systems, to get the action types
This commit is contained in:
parent
515493c675
commit
c8e0011ebc
|
@ -299,6 +299,10 @@ cdef class ArcEager(TransitionSystem):
|
||||||
move_labels[LEFT][label] = True
|
move_labels[LEFT][label] = True
|
||||||
return move_labels
|
return move_labels
|
||||||
|
|
||||||
|
property action_types:
|
||||||
|
def __get__(self):
|
||||||
|
return (SHIFT, REDUCE, LEFT, RIGHT, BREAK)
|
||||||
|
|
||||||
cdef int preprocess_gold(self, GoldParse gold) except -1:
|
cdef int preprocess_gold(self, GoldParse gold) except -1:
|
||||||
for i in range(gold.length):
|
for i in range(gold.length):
|
||||||
if gold.heads[i] is None: # Missing values
|
if gold.heads[i] is None: # Missing values
|
||||||
|
|
|
@ -65,6 +65,10 @@ cdef class BiluoPushDown(TransitionSystem):
|
||||||
move_labels[moves.index(move_str)][label] = True
|
move_labels[moves.index(move_str)][label] = True
|
||||||
return move_labels
|
return move_labels
|
||||||
|
|
||||||
|
property action_types:
|
||||||
|
def __get__(self):
|
||||||
|
return (BEGIN, IN, LAST, UNIT, OUT)
|
||||||
|
|
||||||
def move_name(self, int move, int label):
|
def move_name(self, int move, int label):
|
||||||
if move == OUT:
|
if move == OUT:
|
||||||
return 'O'
|
return 'O'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user