mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 09:26:27 +03:00
* Fix moves for new State struct
This commit is contained in:
parent
82247169f2
commit
399239760b
|
@ -19,11 +19,11 @@ cdef bint can_begin(State* s, int label):
|
||||||
|
|
||||||
|
|
||||||
cdef bint can_in(State* s, int label):
|
cdef bint can_in(State* s, int label):
|
||||||
return entity_is_open(s) and s.ents[s.j].label == label
|
return entity_is_open(s) and s.curr.label == label
|
||||||
|
|
||||||
|
|
||||||
cdef bint can_last(State* s, int label):
|
cdef bint can_last(State* s, int label):
|
||||||
return entity_is_open(s) and s.ents[s.j].label == label
|
return entity_is_open(s) and s.curr.label == label
|
||||||
|
|
||||||
|
|
||||||
cdef bint can_unit(State* s, int label):
|
cdef bint can_unit(State* s, int label):
|
||||||
|
@ -127,13 +127,17 @@ cdef int set_accept_if_valid(Move* moves, int n_classes, State* s) except 0:
|
||||||
|
|
||||||
|
|
||||||
cdef int set_accept_if_oracle(Move* moves, Move* golds, int n_classes, State* s) except 0:
|
cdef int set_accept_if_oracle(Move* moves, Move* golds, int n_classes, State* s) except 0:
|
||||||
|
|
||||||
cdef Move* g = &golds[s.i]
|
cdef Move* g = &golds[s.i]
|
||||||
cdef ActionType next_act = <ActionType>golds[s.i+1].action if s.i < s.length else OUT
|
cdef ActionType next_act = <ActionType>golds[s.i+1].action if s.i < s.length else OUT
|
||||||
cdef bint is_sunk = entity_is_sunk(s, golds)
|
cdef bint is_sunk = entity_is_sunk(s, golds)
|
||||||
cdef Move* m
|
cdef Move* m
|
||||||
cdef int n_accept = 0
|
cdef int n_accept = 0
|
||||||
|
set_accept_if_valid(moves, n_classes, s)
|
||||||
for i in range(n_classes):
|
for i in range(n_classes):
|
||||||
m = &moves[i]
|
m = &moves[i]
|
||||||
|
if not m.accept:
|
||||||
|
continue
|
||||||
m.accept = is_oracle(<ActionType>m.action, m.label, <ActionType>g.action,
|
m.accept = is_oracle(<ActionType>m.action, m.label, <ActionType>g.action,
|
||||||
g.label, next_act, is_sunk)
|
g.label, next_act, is_sunk)
|
||||||
n_accept += m.accept
|
n_accept += m.accept
|
||||||
|
|
Loading…
Reference in New Issue
Block a user