spaCy/website/usage/_models/_install-basics.jade

34 lines
1.3 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.')