Update tagger for new thinc API

This commit is contained in:
Matthew Honnibal 2016-07-31 11:41:48 +02:00
parent 80c2dcd2a3
commit 5869f05bd6

View File

@ -204,7 +204,7 @@ cdef class Tagger:
if tokens.c[i].pos == 0:
self.model.set_featuresC(eg.c, &tokens.c[i])
self.model.set_scoresC(eg.c.scores,
eg.c.features, eg.c.nr_feat, 1)
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.fill_scores(0, eg.c.nr_class)
@ -235,7 +235,7 @@ cdef class Tagger:
self.model.set_featuresC(eg.c, &tokens.c[i])
eg.costs = [ 1 if golds[i] not in (c, -1) else 0 for c in xrange(eg.nr_class) ]
self.model.set_scoresC(eg.c.scores,
eg.c.features, eg.c.nr_feat, 1)
eg.c.features, eg.c.nr_feat)
self.vocab.morphology.assign_tag(&tokens.c[i], eg.guess)
self.model.update(eg)
correct += eg.cost == 0