spaCy/spacy/__init__.py

14 lines
450 B
Python
Raw Normal View History

from . import util
from .about import __models__
import importlib
2016-03-05 16:51:32 +00:00
def load(name, vectors=None, via=None):
if name not in __models__:
raise Exception('Model %s not found.' % name)
mod = importlib.import_module('.%s' % __models__[name]['module'], 'spacy')
return getattr(mod, __models__[name]['class'])(
2016-03-05 16:51:32 +00:00
package=util.get_package_by_name(name, via=via),
2016-03-08 11:59:18 +00:00
vectors_package=util.get_package_by_name(vectors, via=via))