mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +03:00 
			
		
		
		
	Change python -m spacy to spacy
Reflects latest change to entry point or auto-alias
This commit is contained in:
		
							parent
							
								
									65bf80302c
								
							
						
					
					
						commit
						a29f132ffd
					
				| 
						 | 
				
			
			@ -15,7 +15,7 @@ def depr_model_download(lang):
 | 
			
		|||
    lang (unicode): Language shortcut, 'en' or 'de'.
 | 
			
		||||
    """
 | 
			
		||||
    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,
 | 
			
		||||
           about.__docs_models__,
 | 
			
		||||
           "Downloading default '%s' model now..." % lang,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,16 +5,7 @@ include ../../_includes/_mixins
 | 
			
		|||
p
 | 
			
		||||
    |  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
 | 
			
		||||
    |  commands, type #[code python -m spacy]. To make the command even more
 | 
			
		||||
    |  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.
 | 
			
		||||
    |  commands, type #[code spacy --help].
 | 
			
		||||
 | 
			
		||||
+infobox("⚠️ Deprecation note")
 | 
			
		||||
    |  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
 | 
			
		||||
    |  model name to be specified with its version (e.g., #[code en_core_web_sm-1.2.0]).
 | 
			
		||||
 | 
			
		||||
+code(false, "bash").
 | 
			
		||||
    python -m spacy download [model] [--direct]
 | 
			
		||||
+code(false, "bash", "$").
 | 
			
		||||
    spacy download [model] [--direct]
 | 
			
		||||
 | 
			
		||||
+table(["Argument", "Type", "Description"])
 | 
			
		||||
    +row
 | 
			
		||||
| 
						 | 
				
			
			@ -80,8 +71,8 @@ p
 | 
			
		|||
    |  or use the #[+api("cli#package") #[code package]] command to create a
 | 
			
		||||
    |  model package.
 | 
			
		||||
 | 
			
		||||
+code(false, "bash").
 | 
			
		||||
    python -m spacy link [origin] [link_name] [--force]
 | 
			
		||||
+code(false, "bash", "$").
 | 
			
		||||
    spacy link [origin] [link_name] [--force]
 | 
			
		||||
 | 
			
		||||
+table(["Argument", "Type", "Description"])
 | 
			
		||||
    +row
 | 
			
		||||
| 
						 | 
				
			
			@ -112,8 +103,8 @@ p
 | 
			
		|||
    |  markup to copy-paste into #[+a(gh("spacy") + "/issues") GitHub issues].
 | 
			
		||||
 | 
			
		||||
+code(false, "bash").
 | 
			
		||||
    python -m spacy info [--markdown]
 | 
			
		||||
    python -m spacy info [model] [--markdown]
 | 
			
		||||
    spacy info [--markdown]
 | 
			
		||||
    spacy info [model] [--markdown]
 | 
			
		||||
 | 
			
		||||
+table(["Argument", "Type", "Description"])
 | 
			
		||||
    +row
 | 
			
		||||
| 
						 | 
				
			
			@ -139,8 +130,8 @@ p
 | 
			
		|||
    |  functions. The right converter is chosen based on the file extension of
 | 
			
		||||
    |  the input file. Currently only supports #[code .conllu].
 | 
			
		||||
 | 
			
		||||
+code(false, "bash").
 | 
			
		||||
    python -m spacy convert [input_file] [output_dir] [--n-sents] [--morphology]
 | 
			
		||||
+code(false, "bash", "$").
 | 
			
		||||
    spacy convert [input_file] [output_dir] [--n-sents] [--morphology]
 | 
			
		||||
 | 
			
		||||
+table(["Argument", "Type", "Description"])
 | 
			
		||||
    +row
 | 
			
		||||
| 
						 | 
				
			
			@ -174,8 +165,8 @@ p
 | 
			
		|||
    |  Train a model. Expects data in spaCy's
 | 
			
		||||
    |  #[+a("/docs/api/annotation#json-input") JSON format].
 | 
			
		||||
 | 
			
		||||
+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]
 | 
			
		||||
+code(false, "bash", "$").
 | 
			
		||||
    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"])
 | 
			
		||||
    +row
 | 
			
		||||
| 
						 | 
				
			
			@ -345,8 +336,8 @@ p
 | 
			
		|||
    |  sure you're always using the latest versions. This means you need to be
 | 
			
		||||
    |  connected to the internet to use this command.
 | 
			
		||||
 | 
			
		||||
+code(false, "bash").
 | 
			
		||||
    python -m spacy package [input_dir] [output_dir] [--meta] [--force]
 | 
			
		||||
+code(false, "bash", "$").
 | 
			
		||||
    spacy package [input_dir] [output_dir] [--meta] [--force]
 | 
			
		||||
 | 
			
		||||
+table(["Argument", "Type", "Description"])
 | 
			
		||||
    +row
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,9 +8,9 @@ p
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
+aside-code("Download language models", "bash").
 | 
			
		||||
    python -m spacy download en
 | 
			
		||||
    python -m spacy download de
 | 
			
		||||
    python -m spacy download fr
 | 
			
		||||
    spacy download en
 | 
			
		||||
    spacy download de
 | 
			
		||||
    spacy download fr
 | 
			
		||||
 | 
			
		||||
+table([ "Language", "Token", "SBD", "Lemma", "POS", "NER", "Dep", "Vector", "Sentiment"])
 | 
			
		||||
    +row
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -789,4 +789,4 @@ p
 | 
			
		|||
    |  model use the using spaCy's #[+api("cli#train") #[code train]] command:
 | 
			
		||||
 | 
			
		||||
+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]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,10 +32,10 @@ p
 | 
			
		|||
    +qs({package: 'source'}) pip install -r requirements.txt
 | 
			
		||||
    +qs({package: 'source'}) pip install -e .
 | 
			
		||||
 | 
			
		||||
    +qs({model: 'en'}) python -m spacy download en
 | 
			
		||||
    +qs({model: 'de'}) python -m spacy download de
 | 
			
		||||
    +qs({model: 'fr'}) python -m spacy download fr
 | 
			
		||||
    +qs({model: 'es'}) python -m spacy download es
 | 
			
		||||
    +qs({model: 'en'}) spacy download en
 | 
			
		||||
    +qs({model: 'de'}) spacy download de
 | 
			
		||||
    +qs({model: 'fr'}) spacy download fr
 | 
			
		||||
    +qs({model: 'es'}) spacy download es
 | 
			
		||||
 | 
			
		||||
+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].
 | 
			
		||||
 | 
			
		||||
    +code.o-no-block.
 | 
			
		||||
        python -m spacy download en
 | 
			
		||||
        spacy download en
 | 
			
		||||
 | 
			
		||||
        >>> import spacy
 | 
			
		||||
        >>> nlp = spacy.load('en')
 | 
			
		||||
| 
						 | 
				
			
			@ -312,7 +312,9 @@ p
 | 
			
		|||
    |  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]
 | 
			
		||||
    |  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,
 | 
			
		||||
    |  see #[+api("cli#download") download].
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,8 +10,8 @@ p
 | 
			
		|||
+h(2, "models") Install models and process text
 | 
			
		||||
 | 
			
		||||
+code(false, "bash").
 | 
			
		||||
    python -m spacy download en
 | 
			
		||||
    python -m spacy download de
 | 
			
		||||
    spacy download en
 | 
			
		||||
    spacy download de
 | 
			
		||||
 | 
			
		||||
+code.
 | 
			
		||||
    import spacy
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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.")
 | 
			
		||||
    for models, lang in MODELS
 | 
			
		||||
        - 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, load: "module"}, "python") import #{package.id}
 | 
			
		||||
        +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
 | 
			
		||||
    |  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").
 | 
			
		||||
    # 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
 | 
			
		||||
    python -m spacy download en_core_web_md
 | 
			
		||||
    spacy download en_core_web_md
 | 
			
		||||
 | 
			
		||||
    # 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
 | 
			
		||||
    |  The download command will #[+a("#download-pip") install the model] via
 | 
			
		||||
| 
						 | 
				
			
			@ -72,7 +72,7 @@ p
 | 
			
		|||
 | 
			
		||||
+code(false, "bash").
 | 
			
		||||
    pip install spacy
 | 
			
		||||
    python -m spacy download en
 | 
			
		||||
    spacy download en
 | 
			
		||||
 | 
			
		||||
+code.
 | 
			
		||||
    import spacy
 | 
			
		||||
| 
						 | 
				
			
			@ -179,8 +179,8 @@ p
 | 
			
		|||
    |  model names or IDs. And your system already comes with a native solution
 | 
			
		||||
    |  to mapping unicode aliases to file paths: symbolic links.
 | 
			
		||||
 | 
			
		||||
+code(false, "bash").
 | 
			
		||||
    python -m spacy link [package name or path] [shortcut] [--force]
 | 
			
		||||
+code(false, "bash", "$").
 | 
			
		||||
    spacy link [package name or path] [shortcut] [--force]
 | 
			
		||||
 | 
			
		||||
p
 | 
			
		||||
    |  The first argument is the #[strong package name] (if the model was
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,7 +85,7 @@ p
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
+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:
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,7 +102,7 @@ p
 | 
			
		|||
    |  CLI command to create all required files and directories.
 | 
			
		||||
 | 
			
		||||
+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
 | 
			
		||||
    |  To build the package and create a #[code .tar.gz] archive, run
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -238,11 +238,11 @@ p
 | 
			
		|||
+h(3, "features-models") Neural network models for English, German, French, Spanish and multi-language NER
 | 
			
		||||
 | 
			
		||||
+aside-code("Example", "bash").
 | 
			
		||||
    python -m spacy download en # default English model
 | 
			
		||||
    python -m spacy download de # default German model
 | 
			
		||||
    python -m spacy download fr # default French model
 | 
			
		||||
    python -m spacy download es # default Spanish model
 | 
			
		||||
    python -m spacy download xx_ent_wiki_sm # multi-language NER
 | 
			
		||||
    spacy download en # default English model
 | 
			
		||||
    spacy download de # default German model
 | 
			
		||||
    spacy download fr # default French model
 | 
			
		||||
    spacy download es # default Spanish model
 | 
			
		||||
    spacy download xx_ent_wiki_sm # multi-language NER
 | 
			
		||||
 | 
			
		||||
p
 | 
			
		||||
    |  spaCy v2.0 comes with new and improved neural network models for English,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -259,7 +259,7 @@ p
 | 
			
		|||
    |  notebook, the visualizations will be included as HTML.
 | 
			
		||||
 | 
			
		||||
+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
 | 
			
		||||
    from spacy import displacy
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,7 +68,7 @@ include _includes/_mixins
 | 
			
		|||
    +grid
 | 
			
		||||
        +grid-col("two-thirds")
 | 
			
		||||
            +terminal("lightning_tour.py").
 | 
			
		||||
                # Install: pip install spacy && python -m spacy download en
 | 
			
		||||
                # Install: pip install spacy && spacy download en
 | 
			
		||||
                import spacy
 | 
			
		||||
 | 
			
		||||
                # Load English tokenizer, tagger, parser, NER and word vectors
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user