mirror of
https://github.com/explosion/spaCy.git
synced 2025-03-13 07:55:49 +03:00
Dont return Example from init_gold_batch
This commit is contained in:
parent
67c82dbea9
commit
ae7041f182
|
@ -581,12 +581,11 @@ cdef class ArcEager(TransitionSystem):
|
|||
keeps = [i for i, (eg, s) in enumerate(zip(examples, states))
|
||||
if self.has_gold(eg) and not s.is_final()]
|
||||
golds = [ArcEagerGold(self, states[i], examples[i]) for i in keeps]
|
||||
examples = [examples[i] for i in keeps]
|
||||
states = [states[i] for i in keeps]
|
||||
for gold in golds:
|
||||
self._replace_unseen_labels(gold)
|
||||
n_steps = sum([len(s.queue) * 4 for s in states])
|
||||
return states, golds, examples, n_steps
|
||||
return states, golds, n_steps
|
||||
|
||||
def _replace_unseen_labels(self, ArcEagerGold gold):
|
||||
backoff_label = self.strings["dep"]
|
||||
|
|
|
@ -136,7 +136,7 @@ cdef class BiluoPushDown(TransitionSystem):
|
|||
golds = [BiluoGold(self, states[i], examples[i]) for i in keeps]
|
||||
states = [states[i] for i in keeps]
|
||||
n_steps = sum([len(s.queue) for s in states])
|
||||
return states, golds, examples, n_steps
|
||||
return states, golds, n_steps
|
||||
|
||||
cdef Transition lookup_transition(self, object name) except *:
|
||||
cdef attr_t label
|
||||
|
|
|
@ -272,7 +272,7 @@ cdef class Parser:
|
|||
# Prepare the stepwise model, and get the callback for finishing the batch
|
||||
model, backprop_tok2vec = self.model.begin_update(
|
||||
[eg.predicted for eg in examples])
|
||||
states, golds, examples, max_steps = self.moves.init_gold_batch(examples)
|
||||
states, golds, max_steps = self.moves.init_gold_batch(examples)
|
||||
all_states = list(states)
|
||||
states_golds = zip(states, golds)
|
||||
for _ in range(max_steps):
|
||||
|
|
Loading…
Reference in New Issue
Block a user