mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-13 18:56:36 +03:00
Merge branch 'develop'
This commit is contained in:
commit
e4862d1dab
|
@ -3,7 +3,7 @@ pathlib
|
||||||
numpy>=1.7
|
numpy>=1.7
|
||||||
cymem>=1.30,<1.32
|
cymem>=1.30,<1.32
|
||||||
preshed>=0.46.4,<0.47.0
|
preshed>=0.46.4,<0.47.0
|
||||||
thinc>=5.0.0,<5.1.0
|
thinc>=6.0.0,<6.1.0
|
||||||
murmurhash>=0.26,<0.27
|
murmurhash>=0.26,<0.27
|
||||||
plac<0.9.3
|
plac<0.9.3
|
||||||
six
|
six
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -235,7 +235,7 @@ def setup_package():
|
||||||
'murmurhash>=0.26,<0.27',
|
'murmurhash>=0.26,<0.27',
|
||||||
'cymem>=1.30,<1.32',
|
'cymem>=1.30,<1.32',
|
||||||
'preshed>=0.46.0,<0.47.0',
|
'preshed>=0.46.0,<0.47.0',
|
||||||
'thinc>=5.0.0,<5.1.0',
|
'thinc>=6.0.0,<6.1.0',
|
||||||
'plac',
|
'plac',
|
||||||
'six',
|
'six',
|
||||||
'cloudpickle',
|
'cloudpickle',
|
||||||
|
|
|
@ -255,10 +255,10 @@ cdef class Parser:
|
||||||
cdef weight_t loss = 0
|
cdef weight_t loss = 0
|
||||||
cdef Transition action
|
cdef Transition action
|
||||||
while not stcls.is_final():
|
while not stcls.is_final():
|
||||||
self.model.set_featuresC(&eg.c, stcls.c)
|
self.model.set_featuresC(eg.c, stcls.c)
|
||||||
self.moves.set_costs(eg.c.is_valid, eg.c.costs, stcls, gold)
|
self.moves.set_costs(eg.c.is_valid, eg.c.costs, stcls, gold)
|
||||||
self.model.set_scoresC(eg.c.scores, eg.c.features, eg.c.nr_feat)
|
self.model.set_scoresC(eg.c.scores, eg.c.features, eg.c.nr_feat)
|
||||||
self.model.updateC(&eg.c)
|
self.model.updateC(eg.c)
|
||||||
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)
|
||||||
|
|
||||||
action = self.moves.c[eg.guess]
|
action = self.moves.c[eg.guess]
|
||||||
|
@ -343,7 +343,7 @@ cdef class StepwiseState:
|
||||||
|
|
||||||
def predict(self):
|
def predict(self):
|
||||||
self.eg.reset()
|
self.eg.reset()
|
||||||
self.parser.model.set_featuresC(&self.eg.c, self.stcls.c)
|
self.parser.model.set_featuresC(self.eg.c, self.stcls.c)
|
||||||
self.parser.moves.set_valid(self.eg.c.is_valid, self.stcls.c)
|
self.parser.moves.set_valid(self.eg.c.is_valid, self.stcls.c)
|
||||||
self.parser.model.set_scoresC(self.eg.c.scores,
|
self.parser.model.set_scoresC(self.eg.c.scores,
|
||||||
self.eg.c.features, self.eg.c.nr_feat)
|
self.eg.c.features, self.eg.c.nr_feat)
|
||||||
|
|
|
@ -192,7 +192,7 @@ cdef class Tagger:
|
||||||
nr_feat=self.model.nr_feat)
|
nr_feat=self.model.nr_feat)
|
||||||
for i in range(tokens.length):
|
for i in range(tokens.length):
|
||||||
if tokens.c[i].pos == 0:
|
if tokens.c[i].pos == 0:
|
||||||
self.model.set_featuresC(&eg.c, tokens.c, i)
|
self.model.set_featuresC(eg.c, tokens.c, i)
|
||||||
self.model.set_scoresC(eg.c.scores,
|
self.model.set_scoresC(eg.c.scores,
|
||||||
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)
|
||||||
|
@ -244,11 +244,11 @@ cdef class Tagger:
|
||||||
nr_class=self.vocab.morphology.n_tags,
|
nr_class=self.vocab.morphology.n_tags,
|
||||||
nr_feat=self.model.nr_feat)
|
nr_feat=self.model.nr_feat)
|
||||||
for i in range(tokens.length):
|
for i in range(tokens.length):
|
||||||
self.model.set_featuresC(&eg.c, tokens.c, i)
|
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) ]
|
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,
|
self.model.set_scoresC(eg.c.scores,
|
||||||
eg.c.features, eg.c.nr_feat)
|
eg.c.features, eg.c.nr_feat)
|
||||||
self.model.updateC(&eg.c)
|
self.model.updateC(eg.c)
|
||||||
|
|
||||||
self.vocab.morphology.assign_tag_id(&tokens.c[i], eg.guess)
|
self.vocab.morphology.assign_tag_id(&tokens.c[i], eg.guess)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user