mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 10:16:27 +03:00
Merge branch 'develop' of https://github.com/explosion/spaCy into develop
This commit is contained in:
commit
1e6df0a2a1
|
@ -4,9 +4,9 @@ from __future__ import unicode_literals
|
|||
from .cli.info import info as cli_info
|
||||
from .glossary import explain
|
||||
from .deprecated import resolve_load_name
|
||||
from .about import __version__
|
||||
from . import util
|
||||
|
||||
|
||||
def load(name, **overrides):
|
||||
name = resolve_load_name(name, **overrides)
|
||||
return util.load_model(name, **overrides)
|
||||
|
|
|
@ -132,7 +132,7 @@ class Language(object):
|
|||
Defaults = BaseDefaults
|
||||
lang = None
|
||||
|
||||
def __init__(self, vocab=True, make_doc=True, pipeline=None, meta={}):
|
||||
def __init__(self, vocab=True, make_doc=True, pipeline=None, meta={}, **kwargs):
|
||||
"""Initialise a Language object.
|
||||
|
||||
vocab (Vocab): A `Vocab` object. If `True`, a vocab is created via
|
||||
|
|
|
@ -108,12 +108,12 @@ def load_model(name, **overrides):
|
|||
model_path = Path(name)
|
||||
meta = get_package_meta(model_path)
|
||||
cls = get_lang_class(meta['lang'])
|
||||
nlp = cls(pipeline=meta.get('pipeline', True))
|
||||
nlp = cls(pipeline=meta.get('pipeline', True), meta=meta)
|
||||
return nlp.from_disk(model_path, **overrides)
|
||||
elif hasattr(name, 'exists'): # Path or Path-like to model data
|
||||
meta = get_package_meta(name)
|
||||
cls = get_lang_class(meta['lang'])
|
||||
nlp = cls(pipeline=meta.get('pipeline', True))
|
||||
nlp = cls(pipeline=meta.get('pipeline', True), meta=meta)
|
||||
return nlp.from_disk(name, **overrides)
|
||||
raise IOError("Can't find model '%s'" % name)
|
||||
|
||||
|
@ -133,7 +133,7 @@ def load_model_from_init_py(init_file, **overrides):
|
|||
if not model_path.exists():
|
||||
raise ValueError("Can't find model directory: %s" % path2str(data_path))
|
||||
cls = get_lang_class(meta['lang'])
|
||||
nlp = cls(pipeline=meta.get('pipeline', True))
|
||||
nlp = cls(pipeline=meta.get('pipeline', True), meta=meta)
|
||||
return nlp.from_disk(data_path, **overrides)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user