2016-01-15 20:01:02 +03:00
|
|
|
from . import util
|
2016-03-24 13:19:43 +03:00
|
|
|
from .about import __models__
|
|
|
|
import importlib
|
2016-01-15 20:01:02 +03:00
|
|
|
|
|
|
|
|
2016-03-05 19:51:32 +03:00
|
|
|
def load(name, vectors=None, via=None):
|
2016-03-24 13:19:43 +03:00
|
|
|
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 19:51:32 +03:00
|
|
|
package=util.get_package_by_name(name, via=via),
|
2016-03-08 14:59:18 +03:00
|
|
|
vectors_package=util.get_package_by_name(vectors, via=via))
|