python - SpaCy: How to get the spacy model name? -
it doesn't show in pip list
zeke$ pip list | grep spacy spacy (1.7.3)
how name of model?
i tried doesn't work
echo "spacy model:" python3 -m sputnik --name spacy find
throws error:
zeke$ python3 -m sputnik --name spacy find traceback (most recent call last): file "/users/zeke/anaconda/lib/python3.5/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) file "/users/zeke/anaconda/lib/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) file "/users/zeke/anaconda/lib/python3.5/site-packages/sputnik/__main__.py", line 28, in <module> main() file "/users/zeke/anaconda/lib/python3.5/site-packages/sputnik/__main__.py", line 12, in main args.run(args) file "/users/zeke/anaconda/lib/python3.5/site-packages/sputnik/cli.py", line 89, in run data_path=args.data_path) file "/users/zeke/anaconda/lib/python3.5/site-packages/sputnik/__init__.py", line 114, in find obj = cls(app_name, app_version, expand_path(data_path)) file "/users/zeke/anaconda/lib/python3.5/site-packages/sputnik/pool.py", line 19, in __init__ super(pool, self).__init__(app_name, app_version, path, **kwargs) file "/users/zeke/anaconda/lib/python3.5/site-packages/sputnik/package_list.py", line 33, in __init__ self.load() file "/users/zeke/anaconda/lib/python3.5/site-packages/sputnik/package_list.py", line 51, in load package in self.packages(): file "/users/zeke/anaconda/lib/python3.5/site-packages/sputnik/package_list.py", line 47, in packages yield self.__class__.package_class(path=os.path.join(self.path, path)) file "/users/zeke/anaconda/lib/python3.5/site-packages/sputnik/package.py", line 15, in __init__ super(package, self).__init__(defaults=meta['package']) keyerror: 'package'
the sputnik
package manager deprecated of spacy version 1.7.0. in version, should able see installed / linked models using spacy info
:
python -m spacy info # info spacy , installed models python -m spacy info en # info model shortcut link 'en'
all model meta exposed meta
attribute of language
class, within script, can do:
nlp = spacy.load('en') # or other model print(nlp.meta['name'])
if have downloaded models via spacy's new download
command, they'll installed pip packages. means should show when run pip list
or pip freeze
within same environment.
note models not downloaded automatically when install spacy, have download them separately (see the docs list of available models):
python -m spacy download en # default english model (~50mb) python -m spacy download en_core_web_md # larger english model (~1gb)
Comments
Post a Comment