mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
Tweak efficiency of arc_eager.set_costs
This commit is contained in:
parent
e14bf9decb
commit
da50473701
|
@ -729,12 +729,13 @@ cdef class ArcEager(TransitionSystem):
|
||||||
cdef ArcEagerGold gold_ = gold
|
cdef ArcEagerGold gold_ = gold
|
||||||
gold_.update(stcls)
|
gold_.update(stcls)
|
||||||
gold_state = gold_.c
|
gold_state = gold_.c
|
||||||
n_gold = 0
|
cdef int n_gold = 0
|
||||||
for i in range(self.n_moves):
|
for i in range(self.n_moves):
|
||||||
if self.c[i].is_valid(stcls.c, self.c[i].label):
|
if self.c[i].is_valid(stcls.c, self.c[i].label):
|
||||||
is_valid[i] = True
|
is_valid[i] = True
|
||||||
costs[i] = self.c[i].get_cost(stcls, &gold_state, self.c[i].label)
|
costs[i] = self.c[i].get_cost(stcls, &gold_state, self.c[i].label)
|
||||||
n_gold += costs[i] <= 0
|
if costs[i] <= 0:
|
||||||
|
n_gold += 1
|
||||||
else:
|
else:
|
||||||
is_valid[i] = False
|
is_valid[i] = False
|
||||||
costs[i] = 9000
|
costs[i] = 9000
|
||||||
|
|
Loading…
Reference in New Issue
Block a user