Change python -m spacy to spacy

Reflects latest change to entry point or auto-alias
This commit is contained in:
ines 2017-08-14 12:41:06 +02:00 committed by Matthew Honnibal
parent 65bf80302c
commit a29f132ffd
12 changed files with 45 additions and 52 deletions

View File

@ -15,7 +15,7 @@ def depr_model_download(lang):
lang (unicode): Language shortcut, 'en' or 'de'. lang (unicode): Language shortcut, 'en' or 'de'.
""" """
prints("The spacy.%s.download command is now deprecated. Please use " prints("The spacy.%s.download command is now deprecated. Please use "
"python -m spacy download [model name or shortcut] instead. For " "spacy download [model name or shortcut] instead. For "
"more info, see the documentation:" % lang, "more info, see the documentation:" % lang,
about.__docs_models__, about.__docs_models__,
"Downloading default '%s' model now..." % lang, "Downloading default '%s' model now..." % lang,

View File

@ -5,16 +5,7 @@ include ../../_includes/_mixins
p p
| As of v1.7.0, spaCy comes with new command line helpers to download and | As of v1.7.0, spaCy comes with new command line helpers to download and
| link models and show useful debugging information. For a list of available | link models and show useful debugging information. For a list of available
| commands, type #[code python -m spacy]. To make the command even more | commands, type #[code spacy --help].
| convenient, we recommend
| #[+a("https://askubuntu.com/questions/17536/how-do-i-create-a-permanent-bash-alias/17537#17537") creating an alias]
| mapping #[code python -m spacy] to #[code spacy].
+aside("Why python -m?")
| The problem with a global entry point is that it's resolved by looking up
| entries in your #[code PATH] environment variable. This can give you
| unexpected results, like executing the wrong spaCy installation.
| #[code python -m] prevents fallbacks to system modules.
+infobox("⚠️ Deprecation note") +infobox("⚠️ Deprecation note")
| As of spaCy 2.0, the #[code model] command to initialise a model data | As of spaCy 2.0, the #[code model] command to initialise a model data
@ -33,8 +24,8 @@ p
| Direct downloads don't perform any compatibility checks and require the | Direct downloads don't perform any compatibility checks and require the
| model name to be specified with its version (e.g., #[code en_core_web_sm-1.2.0]). | model name to be specified with its version (e.g., #[code en_core_web_sm-1.2.0]).
+code(false, "bash"). +code(false, "bash", "$").
python -m spacy download [model] [--direct] spacy download [model] [--direct]
+table(["Argument", "Type", "Description"]) +table(["Argument", "Type", "Description"])
+row +row
@ -80,8 +71,8 @@ p
| or use the #[+api("cli#package") #[code package]] command to create a | or use the #[+api("cli#package") #[code package]] command to create a
| model package. | model package.
+code(false, "bash"). +code(false, "bash", "$").
python -m spacy link [origin] [link_name] [--force] spacy link [origin] [link_name] [--force]
+table(["Argument", "Type", "Description"]) +table(["Argument", "Type", "Description"])
+row +row
@ -112,8 +103,8 @@ p
| markup to copy-paste into #[+a(gh("spacy") + "/issues") GitHub issues]. | markup to copy-paste into #[+a(gh("spacy") + "/issues") GitHub issues].
+code(false, "bash"). +code(false, "bash").
python -m spacy info [--markdown] spacy info [--markdown]
python -m spacy info [model] [--markdown] spacy info [model] [--markdown]
+table(["Argument", "Type", "Description"]) +table(["Argument", "Type", "Description"])
+row +row
@ -139,8 +130,8 @@ p
| functions. The right converter is chosen based on the file extension of | functions. The right converter is chosen based on the file extension of
| the input file. Currently only supports #[code .conllu]. | the input file. Currently only supports #[code .conllu].
+code(false, "bash"). +code(false, "bash", "$").
python -m spacy convert [input_file] [output_dir] [--n-sents] [--morphology] spacy convert [input_file] [output_dir] [--n-sents] [--morphology]
+table(["Argument", "Type", "Description"]) +table(["Argument", "Type", "Description"])
+row +row
@ -174,8 +165,8 @@ p
| Train a model. Expects data in spaCy's | Train a model. Expects data in spaCy's
| #[+a("/docs/api/annotation#json-input") JSON format]. | #[+a("/docs/api/annotation#json-input") JSON format].
+code(false, "bash"). +code(false, "bash", "$").
python -m spacy train [lang] [output_dir] [train_data] [dev_data] [--n-iter] [--n-sents] [--use-gpu] [--no-tagger] [--no-parser] [--no-entities] spacy train [lang] [output_dir] [train_data] [dev_data] [--n-iter] [--n-sents] [--use-gpu] [--no-tagger] [--no-parser] [--no-entities]
+table(["Argument", "Type", "Description"]) +table(["Argument", "Type", "Description"])
+row +row
@ -345,8 +336,8 @@ p
| sure you're always using the latest versions. This means you need to be | sure you're always using the latest versions. This means you need to be
| connected to the internet to use this command. | connected to the internet to use this command.
+code(false, "bash"). +code(false, "bash", "$").
python -m spacy package [input_dir] [output_dir] [--meta] [--force] spacy package [input_dir] [output_dir] [--meta] [--force]
+table(["Argument", "Type", "Description"]) +table(["Argument", "Type", "Description"])
+row +row

View File

@ -8,9 +8,9 @@ p
+aside-code("Download language models", "bash"). +aside-code("Download language models", "bash").
python -m spacy download en spacy download en
python -m spacy download de spacy download de
python -m spacy download fr spacy download fr
+table([ "Language", "Token", "SBD", "Lemma", "POS", "NER", "Dep", "Vector", "Sentiment"]) +table([ "Language", "Token", "SBD", "Lemma", "POS", "NER", "Dep", "Vector", "Sentiment"])
+row +row

View File

@ -789,4 +789,4 @@ p
| model use the using spaCy's #[+api("cli#train") #[code train]] command: | model use the using spaCy's #[+api("cli#train") #[code train]] command:
+code(false, "bash"). +code(false, "bash").
python -m spacy train [lang] [output_dir] [train_data] [dev_data] [--n-iter] [--n-sents] [--use-gpu] [--no-tagger] [--no-parser] [--no-entities] spacy train [lang] [output_dir] [train_data] [dev_data] [--n-iter] [--n-sents] [--use-gpu] [--no-tagger] [--no-parser] [--no-entities]

View File

@ -32,10 +32,10 @@ p
+qs({package: 'source'}) pip install -r requirements.txt +qs({package: 'source'}) pip install -r requirements.txt
+qs({package: 'source'}) pip install -e . +qs({package: 'source'}) pip install -e .
+qs({model: 'en'}) python -m spacy download en +qs({model: 'en'}) spacy download en
+qs({model: 'de'}) python -m spacy download de +qs({model: 'de'}) spacy download de
+qs({model: 'fr'}) python -m spacy download fr +qs({model: 'fr'}) spacy download fr
+qs({model: 'es'}) python -m spacy download es +qs({model: 'es'}) spacy download es
+h(2, "installation") Installation instructions +h(2, "installation") Installation instructions
@ -52,7 +52,7 @@ p Using pip, spaCy releases are currently only available as source packages.
| and available models, see the #[+a("/docs/usage/models") docs on models]. | and available models, see the #[+a("/docs/usage/models") docs on models].
+code.o-no-block. +code.o-no-block.
python -m spacy download en spacy download en
>>> import spacy >>> import spacy
>>> nlp = spacy.load('en') >>> nlp = spacy.load('en')
@ -312,7 +312,9 @@ p
| This error may occur when running the #[code spacy] command from the | This error may occur when running the #[code spacy] command from the
| command line. spaCy does not currently add an entry to our #[code PATH] | command line. spaCy does not currently add an entry to our #[code PATH]
| environment variable, as this can lead to unexpected results, especially | environment variable, as this can lead to unexpected results, especially
| when using #[code virtualenv]. Run the command with #[code python -m], | when using #[code virtualenv]. Instead, spaCy adds an auto-alias that
| maps #[code spacy] to #[code python -m spacy]. If this is not working as
| expected, run the command with #[code python -m], yourself
| for example #[code python -m spacy download en]. For more info on this, | for example #[code python -m spacy download en]. For more info on this,
| see #[+api("cli#download") download]. | see #[+api("cli#download") download].

View File

@ -10,8 +10,8 @@ p
+h(2, "models") Install models and process text +h(2, "models") Install models and process text
+code(false, "bash"). +code(false, "bash").
python -m spacy download en spacy download en
python -m spacy download de spacy download de
+code. +code.
import spacy import spacy

View File

@ -20,7 +20,7 @@ p
+quickstart(QUICKSTART_MODELS, "Quickstart", "Install a default model, get the code to load it from within spaCy and an example to test it. For more options, see the section on available models below.") +quickstart(QUICKSTART_MODELS, "Quickstart", "Install a default model, get the code to load it from within spaCy and an example to test it. For more options, see the section on available models below.")
for models, lang in MODELS for models, lang in MODELS
- var package = (models.length == 1) ? models[0] : models.find(function(m) { return m.def }) - var package = (models.length == 1) ? models[0] : models.find(function(m) { return m.def })
+qs({lang: lang}) python -m spacy download #{lang} +qs({lang: lang}) spacy download #{lang}
+qs({lang: lang}, "divider") +qs({lang: lang}, "divider")
+qs({lang: lang, load: "module"}, "python") import #{package.id} +qs({lang: lang, load: "module"}, "python") import #{package.id}
+qs({lang: lang, load: "module"}, "python") nlp = #{package.id}.load() +qs({lang: lang, load: "module"}, "python") nlp = #{package.id}.load()
@ -52,16 +52,16 @@ p
| #[+api("cli#download") #[code download]] command. It takes care of | #[+api("cli#download") #[code download]] command. It takes care of
| finding the best-matching model compatible with your spaCy installation. | finding the best-matching model compatible with your spaCy installation.
- var models = Object.keys(MODELS).map(function(lang) { return "python -m spacy download " + lang }) - var models = Object.keys(MODELS).map(function(lang) { return "spacy download " + lang })
+code(false, "bash"). +code(false, "bash").
# out-of-the-box: download best-matching default model # out-of-the-box: download best-matching default model
#{Object.keys(MODELS).map(function(l) {return "python -m spacy download " + l}).join('\n')} #{Object.keys(MODELS).map(function(l) {return "spacy download " + l}).join('\n')}
# download best-matching version of specific model for your spaCy installation # download best-matching version of specific model for your spaCy installation
python -m spacy download en_core_web_md spacy download en_core_web_md
# download exact model version (doesn't create shortcut link) # download exact model version (doesn't create shortcut link)
python -m spacy download en_core_web_md-1.2.0 --direct spacy download en_core_web_md-1.2.0 --direct
p p
| The download command will #[+a("#download-pip") install the model] via | The download command will #[+a("#download-pip") install the model] via
@ -72,7 +72,7 @@ p
+code(false, "bash"). +code(false, "bash").
pip install spacy pip install spacy
python -m spacy download en spacy download en
+code. +code.
import spacy import spacy
@ -179,8 +179,8 @@ p
| model names or IDs. And your system already comes with a native solution | model names or IDs. And your system already comes with a native solution
| to mapping unicode aliases to file paths: symbolic links. | to mapping unicode aliases to file paths: symbolic links.
+code(false, "bash"). +code(false, "bash", "$").
python -m spacy link [package name or path] [shortcut] [--force] spacy link [package name or path] [shortcut] [--force]
p p
| The first argument is the #[strong package name] (if the model was | The first argument is the #[strong package name] (if the model was

View File

@ -85,7 +85,7 @@ p
} }
+code(false, "bash"). +code(false, "bash").
python -m spacy package /home/me/data/en_example_model /home/me/my_models spacy package /home/me/data/en_example_model /home/me/my_models
p This command will create a model package directory that should look like this: p This command will create a model package directory that should look like this:

View File

@ -102,7 +102,7 @@ p
| CLI command to create all required files and directories. | CLI command to create all required files and directories.
+code(false, "bash"). +code(false, "bash").
python -m spacy package /home/me/data/en_technology /home/me/my_models spacy package /home/me/data/en_technology /home/me/my_models
p p
| To build the package and create a #[code .tar.gz] archive, run | To build the package and create a #[code .tar.gz] archive, run

View File

@ -238,11 +238,11 @@ p
+h(3, "features-models") Neural network models for English, German, French, Spanish and multi-language NER +h(3, "features-models") Neural network models for English, German, French, Spanish and multi-language NER
+aside-code("Example", "bash"). +aside-code("Example", "bash").
python -m spacy download en # default English model spacy download en # default English model
python -m spacy download de # default German model spacy download de # default German model
python -m spacy download fr # default French model spacy download fr # default French model
python -m spacy download es # default Spanish model spacy download es # default Spanish model
python -m spacy download xx_ent_wiki_sm # multi-language NER spacy download xx_ent_wiki_sm # multi-language NER
p p
| spaCy v2.0 comes with new and improved neural network models for English, | spaCy v2.0 comes with new and improved neural network models for English,

View File

@ -259,7 +259,7 @@ p
| notebook, the visualizations will be included as HTML. | notebook, the visualizations will be included as HTML.
+code("Jupyter Example"). +code("Jupyter Example").
# don't forget to install a model, e.g.: python -m spacy download en # don't forget to install a model, e.g.: spacy download en
import spacy import spacy
from spacy import displacy from spacy import displacy

View File

@ -68,7 +68,7 @@ include _includes/_mixins
+grid +grid
+grid-col("two-thirds") +grid-col("two-thirds")
+terminal("lightning_tour.py"). +terminal("lightning_tour.py").
# Install: pip install spacy && python -m spacy download en # Install: pip install spacy && spacy download en
import spacy import spacy
# Load English tokenizer, tagger, parser, NER and word vectors # Load English tokenizer, tagger, parser, NER and word vectors