mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 00:46:28 +03:00
Update installation docs and add models quickstart aside
This commit is contained in:
parent
ec75c781b9
commit
807139ae61
|
@ -12,6 +12,16 @@ p
|
|||
| #[a(href="#source-ubuntu") Ubuntu], #[a(href="#source-osx") macOS/OS X]
|
||||
| and #[a(href="#source-windows") Windows] for details.
|
||||
|
||||
+aside("Download models")
|
||||
| After installation you need to download a language model. For more info
|
||||
| and available models, see the #[+a("/docs/usage/models") docs on models].
|
||||
|
||||
+code.o-no-block.
|
||||
python -m spacy.download en
|
||||
|
||||
>>> import spacy
|
||||
>>> nlp = spacy.load('en')
|
||||
|
||||
+h(2, "pip") pip
|
||||
|
||||
p Using pip, spaCy releases are currently only available as source packages.
|
||||
|
@ -43,64 +53,6 @@ p
|
|||
| #[+a("https://github.com/conda-forge/spacy-feedstock") this repository].
|
||||
| Improvements and pull requests to the recipe and setup are always appreciated.
|
||||
|
||||
+h(2, "models") Download models
|
||||
|
||||
p
|
||||
| After installation you need to download a language model. Models for
|
||||
| English (#[code en]) and German (#[code de]) are available.
|
||||
|
||||
+code(false, "bash").
|
||||
python -m spacy.en.download all
|
||||
python -m spacy.de.download all
|
||||
|
||||
+aside-code("Examples", "bash").
|
||||
# Install English tagger, parser and NER
|
||||
python -m spacy.en.download parser
|
||||
|
||||
# Install English GloVe vectors
|
||||
python -m spacy.en.download glove
|
||||
|
||||
# Upgrade/overwrite existing data
|
||||
python -m spacy.en.download --force
|
||||
|
||||
# Check whether the model was successfully installed
|
||||
python -c "import spacy; spacy.load('en'); print('OK')"
|
||||
|
||||
p
|
||||
| The download command fetches about 1 GB of data which it
|
||||
| installs within the #[code spacy] package directory.
|
||||
|
||||
+h(3, "custom-location") Download model to custom location
|
||||
|
||||
p
|
||||
| You can specify where #[code spacy.en.download] and
|
||||
| #[code spacy.de.download] download the language model to using the
|
||||
| #[code --data-path] or #[code -d] argument:
|
||||
|
||||
+code(false, "bash").
|
||||
python -m spacy.en.download all --data-path /some/dir
|
||||
|
||||
p
|
||||
| If you choose to download to a custom location, you will need to tell
|
||||
| spaCy where to load the model from in order to use it. You can do this
|
||||
| either by calling #[code spacy.util.set_data_path()] before calling
|
||||
| #[code spacy.load()], or by passing a #[code path] argument to the
|
||||
| #[code spacy.en.English] or #[code spacy.de.German] constructors.
|
||||
|
||||
+h(3, "models-manual") Download models manually
|
||||
|
||||
p
|
||||
| As of v1.6, the models and word vectors are also available as direct
|
||||
| downloads from GitHub, attached to the #[+a(gh("spaCy") + "/releases") releases] as #[code .tar.gz] archives.
|
||||
|
||||
p
|
||||
| To install the models manually, first find the default data path. You can
|
||||
| use #[code spacy.util.get_data_path()] to find the directory where spaCy
|
||||
| will look for its models, or change the default data path with
|
||||
| #[code spacy.util.set_data_path()]. Then simply unpack the archive and
|
||||
| place the contained folder in that directory. You can now load the models
|
||||
| via #[code spacy.load()].
|
||||
|
||||
+h(2, "source") Compile from source
|
||||
|
||||
p
|
||||
|
|
Loading…
Reference in New Issue
Block a user