mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 09:56:28 +03:00
Update pipelines section in v2 overview
This commit is contained in:
parent
e0a9b02b67
commit
9c96a6e131
|
@ -102,30 +102,36 @@ p
|
||||||
+h(3, "features-pipelines") Improved processing pipelines
|
+h(3, "features-pipelines") Improved processing pipelines
|
||||||
|
|
||||||
+aside-code("Example").
|
+aside-code("Example").
|
||||||
# Modify an existing pipeline
|
# Set custom attributes
|
||||||
nlp = spacy.load('en')
|
Doc.set_extension('my_attr', default=False)
|
||||||
nlp.pipeline.append(my_component)
|
Token.set_extension('my_attr', getter=my_token_getter)
|
||||||
|
assert doc._.my_attr, token._.my_attr
|
||||||
|
|
||||||
# Register a factory to create a component
|
# Add components to the pipeline
|
||||||
spacy.set_factory('my_factory', my_factory)
|
my_component = lambda doc: doc
|
||||||
nlp = Language(pipeline=['my_factory', mycomponent])
|
nlp.add_pipe(my_component)
|
||||||
|
|
||||||
p
|
p
|
||||||
| It's now much easier to #[strong customise the pipeline] with your own
|
| It's now much easier to #[strong customise the pipeline] with your own
|
||||||
| components, functions that receive a #[code Doc] object, modify and
|
| components: functions that receive a #[code Doc] object, modify and
|
||||||
| return it. If your component is stateful, you can define and register a
|
| return it. Extensions let you write any
|
||||||
| factory which receives the shared #[code Vocab] object and returns a
|
| #[strong attributes, properties and methods] to the #[code Doc],
|
||||||
| component. spaCy's default components can be added to your pipeline by
|
| #[code Token] and #[code Span]. You can add data, implement new
|
||||||
| using their string IDs. This way, you won't have to worry about finding
|
| features, integrate other libraries with spaCy or plug in your own
|
||||||
| and implementing them – simply add #[code "tagger"] to the pipeline,
|
| machine learning models.
|
||||||
| and spaCy will know what to do.
|
|
||||||
|
|
||||||
+image
|
+image
|
||||||
include ../assets/img/pipeline.svg
|
include ../assets/img/pipeline.svg
|
||||||
|
|
||||||
+infobox
|
+infobox
|
||||||
| #[+label-inline API:] #[+api("language") #[code Language]]
|
| #[+label-inline API:] #[+api("language") #[code Language]],
|
||||||
| #[+label-inline Usage:] #[+a("/usage/language-processing-pipeline") Processing text]
|
| #[+api("doc#set_extension") #[code Doc.set_extension]],
|
||||||
|
| #[+api("span#set_extension") #[code Span.set_extension]],
|
||||||
|
| #[+api("token#set_extension") #[code Token.set_extension]]
|
||||||
|
| #[+label-inline Usage:]
|
||||||
|
| #[+a("/usage/processing-pipelines") Processing pipelines]
|
||||||
|
| #[+label-inline Code:]
|
||||||
|
| #[+src("/usage/examples#section-pipeline") Pipeline examples]
|
||||||
|
|
||||||
+h(3, "features-text-classification") Text classification
|
+h(3, "features-text-classification") Text classification
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user