mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
* Update for modified thinc interface
This commit is contained in:
parent
5dc6cffc67
commit
8a13cebdcc
|
@ -200,7 +200,9 @@ cdef class Parser:
|
||||||
action = self.moves.c[eg.guess]
|
action = self.moves.c[eg.guess]
|
||||||
action.do(stcls.c, action.label)
|
action.do(stcls.c, action.label)
|
||||||
loss += eg.costs[eg.guess]
|
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
|
return loss
|
||||||
|
|
||||||
def step_through(self, Doc doc):
|
def step_through(self, Doc doc):
|
||||||
|
|
|
@ -209,7 +209,7 @@ cdef class Tagger:
|
||||||
eg.c.features, eg.c.nr_feat)
|
eg.c.features, eg.c.nr_feat)
|
||||||
guess = VecVec.arg_max_if_true(eg.c.scores, eg.c.is_valid, eg.c.nr_class)
|
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)
|
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.is_tagged = True
|
||||||
tokens._py_tokens = [None] * tokens.length
|
tokens._py_tokens = [None] * tokens.length
|
||||||
|
|
||||||
|
@ -244,7 +244,8 @@ cdef class Tagger:
|
||||||
|
|
||||||
correct += eg.cost == 0
|
correct += eg.cost == 0
|
||||||
self.freqs[TAG][tokens.c[i].tag] += 1
|
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.is_tagged = True
|
||||||
tokens._py_tokens = [None] * tokens.length
|
tokens._py_tokens = [None] * tokens.length
|
||||||
return correct
|
return correct
|
||||||
|
|
Loading…
Reference in New Issue
Block a user