From e05bcd6aa838a7098c699a920e92628296961927 Mon Sep 17 00:00:00 2001 From: ines Date: Sat, 27 May 2017 17:57:46 +0200 Subject: [PATCH] Update docs to reflect flattened model meta.json Don't use "setup" key and instead, keep "lang" on root level and add "pipeline". --- .../usage/language-processing-pipeline.jade | 22 ++++++++----------- website/docs/usage/saving-loading.jade | 18 +++++++-------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/website/docs/usage/language-processing-pipeline.jade b/website/docs/usage/language-processing-pipeline.jade index ce23a1666..1392fc2f8 100644 --- a/website/docs/usage/language-processing-pipeline.jade +++ b/website/docs/usage/language-processing-pipeline.jade @@ -19,19 +19,17 @@ 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"] - } + "pipeline": ["token_vectors", "tagger"] } +list("numbers") @@ -287,17 +285,15 @@ 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"] - } + "pipeline": ["vectorizer", "sentiment"] } p @@ -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 diff --git a/website/docs/usage/saving-loading.jade b/website/docs/usage/saving-loading.jade index 477db925c..1ecb7d7ee 100644 --- a/website/docs/usage/saving-loading.jade +++ b/website/docs/usage/saving-loading.jade @@ -74,16 +74,14 @@ 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"] - } + "pipeline": ["token_vectors", "tagger"] } +code(false, "bash"). @@ -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')