2016-01-15 17:01:02 +00:00
|
|
|
from . import util
|
2016-03-24 10:19:43 +00:00
|
|
|
from .about import __models__
|
|
|
|
import importlib
|
2016-01-15 17:01:02 +00:00
|
|
|
|
|
|
|
|
2016-03-05 16:51:32 +00:00
|
|
|
def load(name, vectors=None, via=None):
|
2016-03-24 10:19:43 +00: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 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))
|