Load features by string-name for backwards compatibility.

This commit is contained in:
Matthew Honnibal 2016-10-12 20:15:11 +02:00
parent d3d1db800c
commit d9ae2d68af

View File

@ -82,6 +82,9 @@ cdef class Parser:
def load(cls, path, Vocab vocab, moves_class):
with (path / 'config.json').open() as file_:
cfg = json.load(file_)
# TODO: Remove this when we no longer need to support old-style models
if isinstance(cfg.get('features'), basestring):
cfg['features'] = get_templates(cfg['features'])
moves = moves_class(vocab.strings, cfg['labels'])
model = ParserModel(cfg['features'])
if (path / 'model').exists():