mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 12:18:04 +03:00
288 lines
8.4 KiB
Plaintext
288 lines
8.4 KiB
Plaintext
//- 💫 DOCS > USAGE > COMMAND LINE INTERFACE
|
|
|
|
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 --help].
|
|
|
|
+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, especially when using #[code virtualenv]. For
|
|
| instance, you may have spaCy installed on your system but not in your
|
|
| current environment. The command will then execute the wrong
|
|
| spaCy installation. #[code python -m] prevents fallbacks to system modules
|
|
| and makes sure the correct version of spaCy is used.
|
|
|
|
+h(2, "download") Download
|
|
|
|
p
|
|
| Download #[+a("/docs/usage/models") models] for spaCy. The downloader finds the
|
|
| best-matching compatible version, uses pip to download the model as a
|
|
| package and automatically creates a
|
|
| #[+a("/docs/usage/models#usage") shortcut link] to load the model by name.
|
|
| 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]
|
|
|
|
+table(["Argument", "Type", "Description"])
|
|
+row
|
|
+cell #[code model]
|
|
+cell positional
|
|
+cell Model name or shortcut (#[code en], #[code de], #[code vectors]).
|
|
|
|
+row
|
|
+cell #[code --direct], #[code -d]
|
|
+cell flag
|
|
+cell Force direct download of exact model version.
|
|
|
|
+row
|
|
+cell #[code --help], #[code -h]
|
|
+cell flag
|
|
+cell Show help message and available arguments.
|
|
|
|
|
|
+h(2, "link") Link
|
|
|
|
p
|
|
| Create a #[+a("/docs/usage/models#usage") shortcut link] for a model,
|
|
| either a Python package or a local directory. This will let you load
|
|
| models from any location via #[code spacy.load()].
|
|
|
|
+code(false, "bash").
|
|
python -m spacy link [origin] [link_name] [--force]
|
|
|
|
+table(["Argument", "Type", "Description"])
|
|
+row
|
|
+cell #[code origin]
|
|
+cell positional
|
|
+cell Model name if package, or path to local directory.
|
|
|
|
+row
|
|
+cell #[code link_name]
|
|
+cell positional
|
|
+cell Name of the shortcut link to create.
|
|
|
|
+row
|
|
+cell #[code --force], #[code -f]
|
|
+cell flag
|
|
+cell Force overwriting of existing link.
|
|
|
|
+row
|
|
+cell #[code --help], #[code -h]
|
|
+cell flag
|
|
+cell Show help message and available arguments.
|
|
|
|
+h(2, "info") Info
|
|
|
|
p
|
|
| Print information about your spaCy installation, models and local setup,
|
|
| and generate #[+a("https://en.wikipedia.org/wiki/Markdown") Markdown]-formatted
|
|
| 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]
|
|
|
|
+table(["Argument", "Type", "Description"])
|
|
+row
|
|
+cell #[code model]
|
|
+cell positional
|
|
+cell Shortcut link of model (optional).
|
|
|
|
+row
|
|
+cell #[code --markdown], #[code -md]
|
|
+cell flag
|
|
+cell Print information as Markdown.
|
|
|
|
+row
|
|
+cell #[code --help], #[code -h]
|
|
+cell flag
|
|
+cell Show help message and available arguments.
|
|
|
|
+h(2, "convert") Convert
|
|
+tag experimental
|
|
|
|
p
|
|
| Convert files into spaCy's #[+a("/docs/api/annotation#json-input") JSON format]
|
|
| for use with the #[code train] command and other experiment management
|
|
| 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]
|
|
|
|
+table(["Argument", "Type", "Description"])
|
|
+row
|
|
+cell #[code input_file]
|
|
+cell positional
|
|
+cell Input file.
|
|
|
|
+row
|
|
+cell #[code output_dir]
|
|
+cell positional
|
|
+cell Output directory for converted JSON file.
|
|
|
|
+row
|
|
+cell #[code --n_sents], #[code -n]
|
|
+cell option
|
|
+cell Number of sentences per document.
|
|
|
|
+row
|
|
+cell #[code --morphology], #[code -m]
|
|
+cell option
|
|
+cell Enable appending morphology to tags.
|
|
|
|
+row
|
|
+cell #[code --help], #[code -h]
|
|
+cell flag
|
|
+cell Show help message and available arguments.
|
|
|
|
+h(2, "model") Model
|
|
+tag experimental
|
|
|
|
p
|
|
| Initialise a new model and its data directory. For more info on this, see
|
|
| the documentation on #[+a("/docs/usage/adding-languages") adding languages].
|
|
|
|
+code(false, "bash").
|
|
python -m spacy model [lang] [model_dir] [freqs_data] [clusters_data] [vectors_data]
|
|
|
|
+table(["Argument", "Type", "Description"])
|
|
+row
|
|
+cell #[code lang]
|
|
+cell positional
|
|
+cell Model language.
|
|
|
|
+row
|
|
+cell #[code model_dir]
|
|
+cell positional
|
|
+cell Output directory to store the model in.
|
|
|
|
+row
|
|
+cell #[code freqs_data]
|
|
+cell positional
|
|
+cell Tab-separated frequencies file.
|
|
|
|
+row
|
|
+cell #[code clusters_data]
|
|
+cell positional
|
|
+cell Brown custers file (optional).
|
|
|
|
+row
|
|
+cell #[code vectors_data]
|
|
+cell positional
|
|
+cell Word vectors file (optional).
|
|
|
|
+row
|
|
+cell #[code --help], #[code -h]
|
|
+cell flag
|
|
+cell Show help message and available arguments.
|
|
|
|
+h(2, "train") Train
|
|
+tag experimental
|
|
|
|
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] [--parser_L1] [--no_tagger] [--no_parser] [--no_ner]
|
|
|
|
+table(["Argument", "Type", "Description"])
|
|
+row
|
|
+cell #[code lang]
|
|
+cell positional
|
|
+cell Model language.
|
|
|
|
+row
|
|
+cell #[code output_dir]
|
|
+cell positional
|
|
+cell Directory to store model in.
|
|
|
|
+row
|
|
+cell #[code train_data]
|
|
+cell positional
|
|
+cell Location of JSON-formatted training data.
|
|
|
|
+row
|
|
+cell #[code dev_data]
|
|
+cell positional
|
|
+cell Location of JSON-formatted dev data (optional).
|
|
|
|
+row
|
|
+cell #[code --n_iter], #[code -n]
|
|
+cell option
|
|
+cell Number of iterations (default: #[code 15]).
|
|
|
|
+row
|
|
+cell #[code --parser_L1], #[code -L]
|
|
+cell option
|
|
+cell L1 regularization penalty for parser (default: #[code 0.0]).
|
|
|
|
+row
|
|
+cell #[code --no_tagger], #[code -T]
|
|
+cell flag
|
|
+cell Don't train tagger.
|
|
|
|
+row
|
|
+cell #[code --no_parser], #[code -P]
|
|
+cell flag
|
|
+cell Don't train parser.
|
|
|
|
+row
|
|
+cell #[code --no_ner], #[code -N]
|
|
+cell flag
|
|
+cell Don't train NER.
|
|
|
|
+row
|
|
+cell #[code --help], #[code -h]
|
|
+cell flag
|
|
+cell Show help message and available arguments.
|
|
|
|
+h(2, "package") Package
|
|
+tag experimental
|
|
|
|
p
|
|
| Generate a #[+a("/docs/usage/saving-loading#generating") model Python package]
|
|
| from an existing model data directory. All data files are copied over.
|
|
| If the path to a meta.json is supplied, or a meta.json is found in the
|
|
| input directory, this file is used. Otherwise, the data can be entered
|
|
| directly from the command line. While this feature is still experimental,
|
|
| the required file templates are downloaded from
|
|
| #[+src(gh("spacy-dev-resources", "templates/model")) GitHub]. 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]
|
|
|
|
+table(["Argument", "Type", "Description"])
|
|
+row
|
|
+cell #[code input_dir]
|
|
+cell positional
|
|
+cell Path to directory containing model data.
|
|
|
|
+row
|
|
+cell #[code output_dir]
|
|
+cell positional
|
|
+cell Directory to create package folder in.
|
|
|
|
+row
|
|
+cell #[code meta]
|
|
+cell option
|
|
+cell Path to meta.json file (optional).
|
|
|
|
+row
|
|
+cell #[code --force], #[code -f]
|
|
+cell flag
|
|
+cell Force overwriting of existing folder in output directory.
|
|
|
|
+row
|
|
+cell #[code --help], #[code -h]
|
|
+cell flag
|
|
+cell Show help message and available arguments.
|