From 7544c21f5bff440e60938a0d33c1d73a30b4918e Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 21 Jun 2020 01:12:05 +0200 Subject: [PATCH] Update transition system --- spacy/syntax/transition_system.pyx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spacy/syntax/transition_system.pyx b/spacy/syntax/transition_system.pyx index 319550161..46e438e4c 100644 --- a/spacy/syntax/transition_system.pyx +++ b/spacy/syntax/transition_system.pyx @@ -1,4 +1,5 @@ # cython: infer_types=True +from __future__ import print_function from cpython.ref cimport Py_INCREF from cymem.cymem cimport Pool @@ -67,11 +68,13 @@ cdef class TransitionSystem: costs = mem.alloc(self.n_moves, sizeof(float)) is_valid = mem.alloc(self.n_moves, sizeof(int)) - cdef StateClass state = StateClass(example.predicted, offset=0) - self.initialize_state(state.c) + cdef StateClass state + states, golds, n_steps = self.init_gold_batch([example]) + state = states[0] + gold = golds[0] history = [] while not state.is_final(): - self.set_costs(is_valid, costs, state, example) + self.set_costs(is_valid, costs, state, gold) for i in range(self.n_moves): if is_valid[i] and costs[i] <= 0: action = self.c[i]