Update docs to reflect flattened model meta.json

Don't use "setup" key and instead, keep "lang" on root level and add
"pipeline".
This commit is contained in:
ines 2017-05-27 17:57:46 +02:00
parent a8e58e04ef
commit e05bcd6aa8
2 changed files with 17 additions and 23 deletions

View File

@ -19,20 +19,18 @@ p
p
| When you load a model, spaCy first consults the model's
| #[+a("/docs/usage/saving-loading#models-generating") meta.json] for its
| #[code setup] details. This typically includes the ID of a language class,
| #[+a("/docs/usage/saving-loading#models-generating") meta.json]. The
| meta typically includes the model details, the ID of a language class,
| and an optional list of pipeline components. spaCy then does the
| following:
+aside-code("meta.json (excerpt)", "json").
{
"name": "example_model",
"lang": "en"
"description": "Example model for spaCy",
"setup": {
"lang": "en",
"pipeline": ["token_vectors", "tagger"]
}
}
+list("numbers")
+item
@ -287,18 +285,16 @@ p
p
| In the model package's meta.json, specify the language class and pipeline
| IDs in #[code setup]:
| IDs:
+code("meta.json (excerpt)", "json").
{
"name": "my_sentiment_model",
"name": "sentiment_model",
"lang": "en",
"version": "1.0.0",
"spacy_version": ">=2.0.0,<3.0.0",
"setup": {
"lang": "en",
"pipeline": ["vectorizer", "sentiment"]
}
}
p
| When you load your new model, spaCy will call the model's #[code load()]
@ -307,7 +303,7 @@ p
| by your custom #[code "sentiment"] factory.
+code.
nlp = spacy.load('my_sentiment_model')
nlp = spacy.load('en_sentiment_model')
doc = nlp(u'I love pizza')
assert doc.sentiment

View File

@ -74,17 +74,15 @@ p
+aside-code("meta.json", "json").
{
"name": "example_model",
"lang": "en",
"version": "1.0.0",
"spacy_version": ">=2.0.0,<3.0.0",
"description": "Example model for spaCy",
"author": "You",
"email": "you@example.com",
"license": "CC BY-SA 3.0",
"setup": {
"lang": "en",
"pipeline": ["token_vectors", "tagger"]
}
}
+code(false, "bash").
python -m spacy package /home/me/data/en_example_model /home/me/my_models
@ -110,9 +108,9 @@ p
+h(3, "models-custom") Customising the model setup
p
| The meta.json includes a #[code setup] key that lets you customise how
| the model should be initialised and loaded. You can define the language
| data to be loaded and the
| The meta.json includes the model details, like name, requirements and
| license, and lets you customise how the model should be initialised and
| loaded. You can define the language data to be loaded and the
| #[+a("/docs/usage/language-processing-pipeline") processing pipeline] to
| execute.
@ -183,9 +181,9 @@ p
p
| To load a model from a data directory, you can use
| #[+api("spacy#load") #[code spacy.load()]] with the local path. This will
| look for a meta.json in the directory and use the #[code setup] details
| to initialise a #[code Language] class with a processing pipeline and
| load in the model data.
| look for a meta.json in the directory and use the #[code lang] and
| #[code pipeline] settings to initialise a #[code Language] class with a
| processing pipeline and load in the model data.
+code.
nlp = spacy.load('/path/to/model')