2017-05-24 20:25:13 +03:00
|
|
|
|
//- 💫 DOCS > USAGE > SPACY 101 > PIPELINES
|
|
|
|
|
|
|
|
|
|
p
|
|
|
|
|
| When you call #[code nlp] on a text, spaCy first tokenizes the text to
|
2017-05-25 12:17:21 +03:00
|
|
|
|
| produce a #[code Doc] object. The #[code Doc] is then processed in several
|
2017-05-24 20:25:13 +03:00
|
|
|
|
| different steps – this is also referred to as the
|
2017-05-25 12:17:21 +03:00
|
|
|
|
| #[strong processing pipeline]. The pipeline used by the
|
2017-05-24 20:25:13 +03:00
|
|
|
|
| #[+a("/docs/usage/models") default models] consists of a
|
2017-05-29 00:26:13 +03:00
|
|
|
|
| tensorizer, a tagger, a parser and an entity recognizer. Each pipeline
|
2017-05-24 20:25:13 +03:00
|
|
|
|
| component returns the processed #[code Doc], which is then passed on to
|
|
|
|
|
| the next component.
|
|
|
|
|
|
|
|
|
|
+image
|
|
|
|
|
include ../../../assets/img/docs/pipeline.svg
|
|
|
|
|
.u-text-right
|
|
|
|
|
+button("/assets/img/docs/pipeline.svg", false, "secondary").u-text-tag View large graphic
|
|
|
|
|
|
2017-05-24 23:46:18 +03:00
|
|
|
|
+aside
|
|
|
|
|
| #[strong Name:] ID of the pipeline component.#[br]
|
|
|
|
|
| #[strong Component:] spaCy's implementation of the component.#[br]
|
|
|
|
|
| #[strong Creates:] Objects, attributes and properties modified and set by
|
|
|
|
|
| the component.
|
|
|
|
|
|
2017-05-29 00:26:13 +03:00
|
|
|
|
+table(["Name", "Component", "Creates", "Description"])
|
2017-05-24 20:25:13 +03:00
|
|
|
|
+row
|
|
|
|
|
+cell tokenizer
|
|
|
|
|
+cell #[+api("tokenizer") #[code Tokenizer]]
|
|
|
|
|
+cell #[code Doc]
|
2017-05-29 00:26:13 +03:00
|
|
|
|
+cell Segment text into tokens.
|
2017-05-24 20:25:13 +03:00
|
|
|
|
|
|
|
|
|
+row("divider")
|
2017-05-29 00:26:13 +03:00
|
|
|
|
+cell tensorizer
|
|
|
|
|
+cell #[code TokenVectorEncoder]
|
2017-05-24 20:25:13 +03:00
|
|
|
|
+cell #[code Doc.tensor]
|
2017-05-29 00:26:13 +03:00
|
|
|
|
+cell Create feature representation tensor for #[code Doc].
|
2017-05-24 20:25:13 +03:00
|
|
|
|
|
|
|
|
|
+row
|
|
|
|
|
+cell tagger
|
|
|
|
|
+cell #[+api("tagger") #[code Tagger]]
|
|
|
|
|
+cell #[code Doc[i].tag]
|
2017-05-29 00:26:13 +03:00
|
|
|
|
+cell Assign part-of-speech tags.
|
2017-05-24 20:25:13 +03:00
|
|
|
|
|
|
|
|
|
+row
|
|
|
|
|
+cell parser
|
|
|
|
|
+cell #[+api("dependencyparser") #[code DependencyParser]]
|
|
|
|
|
+cell
|
|
|
|
|
| #[code Doc[i].head], #[code Doc[i].dep], #[code Doc.sents],
|
|
|
|
|
| #[code Doc.noun_chunks]
|
2017-05-29 00:26:13 +03:00
|
|
|
|
+cell Assign dependency labels.
|
2017-05-24 20:25:13 +03:00
|
|
|
|
|
|
|
|
|
+row
|
|
|
|
|
+cell ner
|
|
|
|
|
+cell #[+api("entityrecognizer") #[code EntityRecognizer]]
|
|
|
|
|
+cell #[code Doc.ents], #[code Doc[i].ent_iob], #[code Doc[i].ent_type]
|
2017-05-29 00:26:13 +03:00
|
|
|
|
+cell Detect and label named entities.
|
2017-05-26 13:46:29 +03:00
|
|
|
|
|
|
|
|
|
p
|
|
|
|
|
| The processing pipeline always #[strong depends on the statistical model]
|
|
|
|
|
| and its capabilities. For example, a pipeline can only include an entity
|
|
|
|
|
| recognizer component if the model includes data to make predictions of
|
|
|
|
|
| entity labels. This is why each model will specify the pipeline to use
|
|
|
|
|
| in its meta data, as a simple list containing the component names:
|
|
|
|
|
|
|
|
|
|
+code(false, "json").
|
2017-05-29 00:26:13 +03:00
|
|
|
|
"pipeline": ["tensorizer", "tagger", "parser", "ner"]
|