mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 12:18:04 +03:00
44 lines
1.9 KiB
Plaintext
44 lines
1.9 KiB
Plaintext
//- 💫 DOCS > USAGE > MODELS > INSTALLATION BASICS
|
|
|
|
p
|
|
| The easiest way to download a model is via spaCy's
|
|
| #[+api("cli#download") #[code download]] command. It takes care of
|
|
| finding the best-matching model compatible with your spaCy installation.
|
|
|
|
- var models = Object.keys(MODELS).map(function(lang) { return "python -m spacy download " + lang })
|
|
+code(false, "bash").
|
|
# out-of-the-box: download best-matching default model
|
|
#{Object.keys(MODELS).map(function(l) {return "python -m spacy download " + l}).join('\n')}
|
|
|
|
# download best-matching version of specific model for your spaCy installation
|
|
python -m spacy download en_core_web_sm
|
|
|
|
# download exact model version (doesn't create shortcut link)
|
|
python -m spacy download en_core_web_sm-2.0.0 --direct
|
|
|
|
p
|
|
| The download command will #[+a("/usage/models#download-pip") install the model] via
|
|
| pip, place the package in your #[code site-packages] directory and create
|
|
| a #[+a("/usage/models#usage") shortcut link] that lets you load the model by a custom
|
|
| name. The shortcut link will be the same as the model name used in
|
|
| #[code spacy download].
|
|
|
|
+code(false, "bash").
|
|
pip install spacy
|
|
python -m spacy download en
|
|
|
|
+code.
|
|
import spacy
|
|
nlp = spacy.load('en')
|
|
doc = nlp(u'This is a sentence.')
|
|
|
|
+infobox("Important note", "⚠️")
|
|
| To allow loading models via convenient shortcuts like #[code 'en'], spaCy
|
|
| will create a symlink within the #[code spacy/data] directory. This means
|
|
| that your user needs the #[strong required permissions].
|
|
| If you've installed spaCy to a system directory and don't have admin
|
|
| privileges, the model linking may fail. The easiest solution
|
|
| is to re-run the command as admin, or use a #[code virtualenv]. For more
|
|
| info on this, see the
|
|
| #[+a("/usage/#symlink-privilege") troubleshooting guide].
|