mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 01:16:28 +03:00
b9ba58ba5c
Warn if old 'path' keyword argument is used.
23 lines
658 B
Python
23 lines
658 B
Python
# coding: utf8
|
|
from __future__ import unicode_literals
|
|
|
|
import importlib
|
|
|
|
from .compat import basestring_
|
|
from .cli.info import info
|
|
from .glossary import explain
|
|
from . import util
|
|
|
|
|
|
def load(name, **overrides):
|
|
name = util.resolve_load_name(name, **overrides)
|
|
model_path = util.resolve_model_path(name)
|
|
meta = util.parse_package_meta(model_path)
|
|
if 'lang' not in meta:
|
|
raise IOError('No language setting found in model meta.')
|
|
module = importlib.import_module('.%s' % meta['lang'], 'spacy')
|
|
cls = getattr(module, module.__all__[0])
|
|
overrides['meta'] = meta
|
|
overrides['path'] = model_path
|
|
return cls(**overrides)
|