Update spacy train CLI documentation

This commit is contained in:
ines 2017-03-26 15:33:48 +02:00
parent 9dcb58aaaf
commit 5901c8f7f0
2 changed files with 73 additions and 9 deletions

View File

@ -77,20 +77,22 @@ class CLI(object):
@plac.annotations( @plac.annotations(
lang=("language", "positional", None, str), lang=("model language", "positional", None, str),
output_dir=("output directory", "positional", None, str), output_dir=("output directory to store model in", "positional", None, str),
train_data=("training data", "positional", None, str), train_data=("location of JSON-formatted training data", "positional", None, str),
dev_data=("development data", "positional", None, str), dev_data=("location of JSON-formatted development data (optional)", "positional", None, str),
n_iter=("number of iterations", "option", "n", int), n_iter=("number of iterations", "option", "n", int),
parser_L1=("L1 regularization penalty for parser", "option", "L", float), parser_L1=("L1 regularization penalty for parser", "option", "L", float),
no_tagger=("Don't train tagger", "flag", "T", bool), no_tagger=("Don't train tagger", "flag", "T", bool),
no_parser=("Don't train parser", "flag", "P", bool), no_parser=("Don't train parser", "flag", "P", bool),
no_ner=("Don't train NER", "flag", "N", bool) no_ner=("Don't train NER", "flag", "N", bool)
) )
def train(self, lang, output_dir, train_data, dev_data, n_iter=15, def train(self, lang, output_dir, train_data, dev_data=None, n_iter=15,
parser_L1=0.0, parser_L1=0.0, no_tagger=False, no_parser=False, no_ner=False):
no_tagger=False, no_parser=False, no_ner=False): """
"""Train a model.""" Train a model. Expects data in spaCy's JSON format.
"""
cli_train(lang, output_dir, train_data, dev_data, n_iter, cli_train(lang, output_dir, train_data, dev_data, n_iter,
not no_tagger, not no_parser, not no_ner, not no_tagger, not no_parser, not no_ner,
parser_L1) parser_L1)
@ -100,7 +102,9 @@ class CLI(object):
config=("config", "positional", None, str), config=("config", "positional", None, str),
) )
def train_config(self, config): def train_config(self, config):
"""Train a model from config file.""" """
Train a model from config file.
"""
cli_train_config(config) cli_train_config(config)

View File

@ -138,3 +138,63 @@ p
+cell #[code --help], #[code -h] +cell #[code --help], #[code -h]
+cell flag +cell flag
+cell Show help message and available arguments. +cell Show help message and available arguments.
+h(2, "train") Train
+tag experimental
p
| Train a model. Expects data in spaCy's 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.