mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 12:18:04 +03:00
086a06e7d7
Workaround for Plac
27 lines
721 B
Python
27 lines
721 B
Python
# coding: utf8
|
|
from __future__ import unicode_literals
|
|
|
|
import importlib
|
|
|
|
from .compat import basestring_
|
|
from .cli.info import info as cli_info
|
|
from .glossary import explain
|
|
from .deprecated import resolve_load_name
|
|
from . import util
|
|
|
|
|
|
def load(name, **overrides):
|
|
name = 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.')
|
|
cls = util.get_lang_class(meta['lang'])
|
|
overrides['meta'] = meta
|
|
overrides['path'] = model_path
|
|
return cls(**overrides)
|
|
|
|
|
|
def info(model=None, markdown=False):
|
|
return cli_info(None, model, markdown)
|