* Update for modified thinc interface

This commit is contained in:
Matthew Honnibal 2016-02-05 11:44:39 +01:00
parent 5dc6cffc67
commit 8a13cebdcc
2 changed files with 6 additions and 3 deletions

View File

@ -200,7 +200,9 @@ cdef class Parser:
action = self.moves.c[eg.guess]
action.do(stcls.c, action.label)
loss += eg.costs[eg.guess]
eg.reset_classes(eg.nr_class)
eg.fill_scores(0, eg.nr_class)
eg.fill_costs(0, eg.nr_class)
eg.fill_is_valid(0, eg.nr_class)
return loss
def step_through(self, Doc doc):

View File

@ -209,7 +209,7 @@ cdef class Tagger:
eg.c.features, eg.c.nr_feat)
guess = VecVec.arg_max_if_true(eg.c.scores, eg.c.is_valid, eg.c.nr_class)
self.vocab.morphology.assign_tag(&tokens.c[i], guess)
eg.reset_classes(eg.c.nr_class)
eg.fill_scores(0, eg.c.nr_class)
tokens.is_tagged = True
tokens._py_tokens = [None] * tokens.length
@ -244,7 +244,8 @@ cdef class Tagger:
correct += eg.cost == 0
self.freqs[TAG][tokens.c[i].tag] += 1
eg.reset_classes(eg.c.nr_class)
eg.fill_scores(0, eg.c.nr_class)
eg.fill_costs(0, eg.c.nr_class)
tokens.is_tagged = True
tokens._py_tokens = [None] * tokens.length
return correct