mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
* Add curr field to State, to handle entity being built
This commit is contained in:
parent
10e9e14c4f
commit
3709ed9d6d
|
@ -8,7 +8,8 @@ cdef int begin_entity(State* s, label) except -1:
|
||||||
|
|
||||||
cdef int end_entity(State* s) except -1:
|
cdef int end_entity(State* s) except -1:
|
||||||
s.curr.end = s.i + 1
|
s.curr.end = s.i + 1
|
||||||
s.curr[s.j] = s.curr
|
s.ents[s.j] = s.curr
|
||||||
|
s.j += 1
|
||||||
s.curr.start = 0
|
s.curr.start = 0
|
||||||
s.curr.label = -1
|
s.curr.label = -1
|
||||||
s.curr.end = 0
|
s.curr.end = 0
|
||||||
|
@ -16,7 +17,7 @@ cdef int end_entity(State* s) except -1:
|
||||||
|
|
||||||
cdef State* init_state(Pool mem, int sent_length) except NULL:
|
cdef State* init_state(Pool mem, int sent_length) except NULL:
|
||||||
s = <State*>mem.alloc(1, sizeof(State))
|
s = <State*>mem.alloc(1, sizeof(State))
|
||||||
s.j = -1
|
s.j = 0
|
||||||
s.ents = <Entity*>mem.alloc(sent_length, sizeof(Entity))
|
s.ents = <Entity*>mem.alloc(sent_length, sizeof(Entity))
|
||||||
for i in range(sent_length):
|
for i in range(sent_length):
|
||||||
s.ents[i].label = -1
|
s.ents[i].label = -1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user