mirror of https://github.com/explosion/spaCy.git
Persist the actions within spacy.parser.cfg
This commit is contained in:
parent
0605b95f2e
commit
4eef200bab
|
@ -174,13 +174,14 @@ cdef class Parser:
|
||||||
if TransitionSystem is None:
|
if TransitionSystem is None:
|
||||||
TransitionSystem = self.TransitionSystem
|
TransitionSystem = self.TransitionSystem
|
||||||
self.vocab = vocab
|
self.vocab = vocab
|
||||||
actions = TransitionSystem.get_actions(**cfg)
|
cfg['actions'] = TransitionSystem.get_actions(**cfg)
|
||||||
self.moves = TransitionSystem(vocab.strings, actions)
|
self.moves = TransitionSystem(vocab.strings, cfg['actions'])
|
||||||
# TODO: Remove this when we no longer need to support old-style models
|
# TODO: Remove this when we no longer need to support old-style models
|
||||||
if isinstance(cfg.get('features'), basestring):
|
if isinstance(cfg.get('features'), basestring):
|
||||||
cfg['features'] = get_templates(cfg['features'])
|
cfg['features'] = get_templates(cfg['features'])
|
||||||
elif 'features' not in cfg:
|
elif 'features' not in cfg:
|
||||||
cfg['features'] = self.feature_templates
|
cfg['features'] = self.feature_templates
|
||||||
|
|
||||||
self.model = ParserModel(cfg['features'])
|
self.model = ParserModel(cfg['features'])
|
||||||
self.model.l1_penalty = cfg.get('L1', 0.0)
|
self.model.l1_penalty = cfg.get('L1', 0.0)
|
||||||
self.model.learn_rate = cfg.get('learn_rate', 0.001)
|
self.model.learn_rate = cfg.get('learn_rate', 0.001)
|
||||||
|
|
Loading…
Reference in New Issue