mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
* Some minor clean-up after HastyModel
This commit is contained in:
parent
aafaf58cbe
commit
5d9a096e2f
|
@ -16,7 +16,6 @@ cdef int arg_max(const weight_t* scores, const int n_classes) nogil
|
|||
|
||||
|
||||
cdef class Model:
|
||||
cdef Pool mem
|
||||
cdef int n_classes
|
||||
|
||||
cdef int update(self, atom_t* context, class_t guess, class_t gold, int cost) except -1
|
||||
|
@ -25,7 +24,7 @@ cdef class Model:
|
|||
cdef Extractor _extractor
|
||||
cdef LinearModel _model
|
||||
|
||||
cdef inline const weight_t* score(self, atom_t* context):
|
||||
cdef inline const weight_t* score(self, atom_t* context) except NULL:
|
||||
cdef int n_feats
|
||||
feats = self._extractor.get_feats(context, &n_feats)
|
||||
return self._model.get_scores(feats, n_feats)
|
||||
|
|
|
@ -27,7 +27,6 @@ cdef class Model:
|
|||
def __init__(self, n_classes, templates, model_loc=None):
|
||||
if model_loc is not None and path.isdir(model_loc):
|
||||
model_loc = path.join(model_loc, 'model')
|
||||
self.mem = Pool()
|
||||
self.n_classes = n_classes
|
||||
self._extractor = Extractor(templates)
|
||||
self._model = LinearModel(n_classes, self._extractor.n_templ)
|
||||
|
|
|
@ -235,7 +235,6 @@ cdef class EnPosTagger:
|
|||
self.tag_map = cfg['tag_map']
|
||||
cdef int n_tags = len(self.tag_names) + 1
|
||||
|
||||
hasty_templates = ((W_sic,), (P1_pos, P2_pos), (N1_sic,))
|
||||
self.model = Model(n_tags, cfg['templates'], model_dir)
|
||||
self._morph_cache = PreshMapArray(n_tags)
|
||||
self.tags = <PosTag*>self.mem.alloc(n_tags, sizeof(PosTag))
|
||||
|
|
|
@ -64,7 +64,6 @@ cdef class GreedyParser:
|
|||
self.cfg = Config.read(model_dir, 'config')
|
||||
self.moves = TransitionSystem(self.cfg.left_labels, self.cfg.right_labels)
|
||||
hasty_templ, full_templ = get_templates(self.cfg.features)
|
||||
#self.model = HastyModel(self.moves.n_moves, hasty_templ, full_templ, model_dir)
|
||||
self.model = Model(self.moves.n_moves, full_templ, model_dir)
|
||||
|
||||
cpdef int parse(self, Tokens tokens) except -1:
|
||||
|
|
Loading…
Reference in New Issue
Block a user