mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 04:08:09 +03:00
* Add set_scores method to Model
This commit is contained in:
parent
a3964957f6
commit
bd82a49994
|
@ -19,6 +19,7 @@ cdef class Model:
|
|||
cdef int n_classes
|
||||
|
||||
cdef const weight_t* score(self, atom_t* context) except NULL
|
||||
cdef int set_scores(self, weight_t* scores, atom_t* context) except -1
|
||||
|
||||
cdef int update(self, atom_t* context, class_t guess, class_t gold, int cost) except -1
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# cython: profile=True
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import division
|
||||
|
||||
|
@ -38,6 +39,11 @@ cdef class Model:
|
|||
feats = self._extractor.get_feats(context, &n_feats)
|
||||
return self._model.get_scores(feats, n_feats)
|
||||
|
||||
cdef int set_scores(self, weight_t* scores, atom_t* context) except -1:
|
||||
cdef int n_feats
|
||||
feats = self._extractor.get_feats(context, &n_feats)
|
||||
self._model.set_scores(scores, feats, n_feats)
|
||||
|
||||
cdef int update(self, atom_t* context, class_t guess, class_t gold, int cost) except -1:
|
||||
cdef int n_feats
|
||||
if cost == 0:
|
||||
|
|
Loading…
Reference in New Issue
Block a user