mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-13 18:56:36 +03:00
Fix Issue #429. Add an initialize_state method to the named entity recogniser that adds missing entity types. This is a messy place to add this, because it's strange to have the method mutate state. A better home for this logic could be found.
This commit is contained in:
parent
afea6505f3
commit
301f3cc898
|
@ -158,6 +158,15 @@ cdef class BiluoPushDown(TransitionSystem):
|
||||||
raise Exception(move)
|
raise Exception(move)
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
cdef int initialize_state(self, StateC* st) nogil:
|
||||||
|
for i in range(st.length):
|
||||||
|
if st._sent[i].ent_type != 0:
|
||||||
|
with gil:
|
||||||
|
self.add_action(BEGIN, st._sent[i].ent_type)
|
||||||
|
self.add_action(IN, st._sent[i].ent_type)
|
||||||
|
self.add_action(UNIT, st._sent[i].ent_type)
|
||||||
|
self.add_action(LAST, st._sent[i].ent_type)
|
||||||
|
|
||||||
|
|
||||||
cdef class Missing:
|
cdef class Missing:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue
Block a user