mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Update docstrings and docs [ci skip]
This commit is contained in:
parent
a4b448eec4
commit
64f2f84098
|
@ -172,7 +172,7 @@ class TextCategorizer(Pipe):
|
||||||
return scores
|
return scores
|
||||||
|
|
||||||
def set_annotations(self, docs: Iterable[Doc], scores) -> None:
|
def set_annotations(self, docs: Iterable[Doc], scores) -> None:
|
||||||
"""Modify a batch of documents, using pre-computed scores.
|
"""Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
|
||||||
|
|
||||||
docs (Iterable[Doc]): The documents to modify.
|
docs (Iterable[Doc]): The documents to modify.
|
||||||
scores: The scores to set, produced by TextCategorizer.predict.
|
scores: The scores to set, produced by TextCategorizer.predict.
|
||||||
|
|
|
@ -162,7 +162,8 @@ Initialize the pipe for training, using data examples if available. Returns an
|
||||||
|
|
||||||
## DependencyParser.predict {#predict tag="method"}
|
## DependencyParser.predict {#predict tag="method"}
|
||||||
|
|
||||||
Apply the pipeline's model to a batch of docs, without modifying them.
|
Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
|
||||||
|
modifying them.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -178,7 +179,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
|
||||||
|
|
||||||
## DependencyParser.set_annotations {#set_annotations tag="method"}
|
## DependencyParser.set_annotations {#set_annotations tag="method"}
|
||||||
|
|
||||||
Modify a batch of documents, using pre-computed scores.
|
Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
|
|
@ -162,9 +162,9 @@ Initialize the pipe for training, using data examples if available. Returns an
|
||||||
|
|
||||||
## EntityLinker.predict {#predict tag="method"}
|
## EntityLinker.predict {#predict tag="method"}
|
||||||
|
|
||||||
Apply the pipeline's model to a batch of docs, without modifying them. Returns
|
Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
|
||||||
the KB IDs for each entity in each doc, including `NIL` if there is no
|
modifying them. Returns the KB IDs for each entity in each doc, including `NIL`
|
||||||
prediction.
|
if there is no prediction.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
|
|
@ -151,7 +151,8 @@ Initialize the pipe for training, using data examples if available. Returns an
|
||||||
|
|
||||||
## EntityRecognizer.predict {#predict tag="method"}
|
## EntityRecognizer.predict {#predict tag="method"}
|
||||||
|
|
||||||
Apply the pipeline's model to a batch of docs, without modifying them.
|
Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
|
||||||
|
modifying them.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -167,7 +168,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
|
||||||
|
|
||||||
## EntityRecognizer.set_annotations {#set_annotations tag="method"}
|
## EntityRecognizer.set_annotations {#set_annotations tag="method"}
|
||||||
|
|
||||||
Modify a batch of documents, using pre-computed scores.
|
Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
|
|
@ -142,7 +142,8 @@ Initialize the pipe for training, using data examples if available. Returns an
|
||||||
|
|
||||||
## Morphologizer.predict {#predict tag="method"}
|
## Morphologizer.predict {#predict tag="method"}
|
||||||
|
|
||||||
Apply the pipeline's model to a batch of docs, without modifying them.
|
Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
|
||||||
|
modifying them.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -158,7 +159,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
|
||||||
|
|
||||||
## Morphologizer.set_annotations {#set_annotations tag="method"}
|
## Morphologizer.set_annotations {#set_annotations tag="method"}
|
||||||
|
|
||||||
Modify a batch of documents, using pre-computed scores.
|
Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -175,8 +176,9 @@ Modify a batch of documents, using pre-computed scores.
|
||||||
|
|
||||||
## Morphologizer.update {#update tag="method"}
|
## Morphologizer.update {#update tag="method"}
|
||||||
|
|
||||||
Learn from a batch of documents and gold-standard information, updating the
|
Learn from a batch of [`Example`](/api/example) objects containing the
|
||||||
pipe's model. Delegates to [`predict`](/api/morphologizer#predict) and
|
predictions and gold-standard annotations, and update the component's model.
|
||||||
|
Delegates to [`predict`](/api/morphologizer#predict) and
|
||||||
[`get_loss`](/api/morphologizer#get_loss).
|
[`get_loss`](/api/morphologizer#get_loss).
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
|
|
|
@ -8,7 +8,18 @@ This class is a base class and **not instantiated directly**. Trainable pipeline
|
||||||
components like the [`EntityRecognizer`](/api/entityrecognizer) or
|
components like the [`EntityRecognizer`](/api/entityrecognizer) or
|
||||||
[`TextCategorizer`](/api/textcategorizer) inherit from it and it defines the
|
[`TextCategorizer`](/api/textcategorizer) inherit from it and it defines the
|
||||||
interface that components should follow to function as trainable components in a
|
interface that components should follow to function as trainable components in a
|
||||||
spaCy pipeline.
|
spaCy pipeline. See the docs on
|
||||||
|
[writing trainable components](/usage/processing-pipelines#trainable) for how to
|
||||||
|
use the `Pipe` base class to implement custom components.
|
||||||
|
|
||||||
|
> #### Why is Pipe implemented in Cython?
|
||||||
|
>
|
||||||
|
> The `Pipe` class is implemented in a `.pyx` module, the extension used by
|
||||||
|
> [Cython](/api/cython). This is needed so that **other** Cython classes, like
|
||||||
|
> the [`EntityRecognizer`](/api/entityrecognizer) can inherit from it. But it
|
||||||
|
> doesn't mean you have to implement trainable components in Cython – pure
|
||||||
|
> Python components like the [`TextCategorizer`](/api/textcategorizer) can also
|
||||||
|
> inherit from `Pipe`.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
https://github.com/explosion/spaCy/blob/develop/spacy/pipeline/pipe.pyx
|
https://github.com/explosion/spaCy/blob/develop/spacy/pipeline/pipe.pyx
|
||||||
|
@ -115,7 +126,8 @@ Initialize the pipe for training, using data examples if available. Returns an
|
||||||
|
|
||||||
## Pipe.predict {#predict tag="method"}
|
## Pipe.predict {#predict tag="method"}
|
||||||
|
|
||||||
Apply the pipeline's model to a batch of docs, without modifying them.
|
Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
|
||||||
|
modifying them.
|
||||||
|
|
||||||
<Infobox variant="danger">
|
<Infobox variant="danger">
|
||||||
|
|
||||||
|
@ -137,7 +149,7 @@ This method needs to be overwritten with your own custom `predict` method.
|
||||||
|
|
||||||
## Pipe.set_annotations {#set_annotations tag="method"}
|
## Pipe.set_annotations {#set_annotations tag="method"}
|
||||||
|
|
||||||
Modify a batch of documents, using pre-computed scores.
|
Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
|
||||||
|
|
||||||
<Infobox variant="danger">
|
<Infobox variant="danger">
|
||||||
|
|
||||||
|
@ -161,8 +173,8 @@ method.
|
||||||
|
|
||||||
## Pipe.update {#update tag="method"}
|
## Pipe.update {#update tag="method"}
|
||||||
|
|
||||||
Learn from a batch of documents and gold-standard information, updating the
|
Learn from a batch of [`Example`](/api/example) objects containing the
|
||||||
pipe's model. Delegates to [`predict`](/api/pipe#predict).
|
predictions and gold-standard annotations, and update the component's model.
|
||||||
|
|
||||||
<Infobox variant="danger">
|
<Infobox variant="danger">
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,8 @@ Initialize the pipe for training, using data examples if available. Returns an
|
||||||
|
|
||||||
## SentenceRecognizer.predict {#predict tag="method"}
|
## SentenceRecognizer.predict {#predict tag="method"}
|
||||||
|
|
||||||
Apply the pipeline's model to a batch of docs, without modifying them.
|
Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
|
||||||
|
modifying them.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -152,7 +153,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
|
||||||
|
|
||||||
## SentenceRecognizer.set_annotations {#set_annotations tag="method"}
|
## SentenceRecognizer.set_annotations {#set_annotations tag="method"}
|
||||||
|
|
||||||
Modify a batch of documents, using pre-computed scores.
|
Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -169,8 +170,9 @@ Modify a batch of documents, using pre-computed scores.
|
||||||
|
|
||||||
## SentenceRecognizer.update {#update tag="method"}
|
## SentenceRecognizer.update {#update tag="method"}
|
||||||
|
|
||||||
Learn from a batch of documents and gold-standard information, updating the
|
Learn from a batch of [`Example`](/api/example) objects containing the
|
||||||
pipe's model. Delegates to [`predict`](/api/sentencerecognizer#predict) and
|
predictions and gold-standard annotations, and update the component's model.
|
||||||
|
Delegates to [`predict`](/api/sentencerecognizer#predict) and
|
||||||
[`get_loss`](/api/sentencerecognizer#get_loss).
|
[`get_loss`](/api/sentencerecognizer#get_loss).
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
|
|
|
@ -134,7 +134,8 @@ Initialize the pipe for training, using data examples if available. Returns an
|
||||||
|
|
||||||
## Tagger.predict {#predict tag="method"}
|
## Tagger.predict {#predict tag="method"}
|
||||||
|
|
||||||
Apply the pipeline's model to a batch of docs, without modifying them.
|
Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
|
||||||
|
modifying them.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -150,7 +151,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
|
||||||
|
|
||||||
## Tagger.set_annotations {#set_annotations tag="method"}
|
## Tagger.set_annotations {#set_annotations tag="method"}
|
||||||
|
|
||||||
Modify a batch of documents, using pre-computed scores.
|
Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -167,8 +168,9 @@ Modify a batch of documents, using pre-computed scores.
|
||||||
|
|
||||||
## Tagger.update {#update tag="method"}
|
## Tagger.update {#update tag="method"}
|
||||||
|
|
||||||
Learn from a batch of documents and gold-standard information, updating the
|
Learn from a batch of [`Example`](/api/example) objects containing the
|
||||||
pipe's model. Delegates to [`predict`](/api/tagger#predict) and
|
predictions and gold-standard annotations, and update the component's model.
|
||||||
|
Delegates to [`predict`](/api/tagger#predict) and
|
||||||
[`get_loss`](/api/tagger#get_loss).
|
[`get_loss`](/api/tagger#get_loss).
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
|
|
|
@ -142,7 +142,8 @@ Initialize the pipe for training, using data examples if available. Returns an
|
||||||
|
|
||||||
## TextCategorizer.predict {#predict tag="method"}
|
## TextCategorizer.predict {#predict tag="method"}
|
||||||
|
|
||||||
Apply the pipeline's model to a batch of docs, without modifying them.
|
Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
|
||||||
|
modifying them.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -158,7 +159,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
|
||||||
|
|
||||||
## TextCategorizer.set_annotations {#set_annotations tag="method"}
|
## TextCategorizer.set_annotations {#set_annotations tag="method"}
|
||||||
|
|
||||||
Modify a batch of documents, using pre-computed scores.
|
Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -175,8 +176,9 @@ Modify a batch of documents, using pre-computed scores.
|
||||||
|
|
||||||
## TextCategorizer.update {#update tag="method"}
|
## TextCategorizer.update {#update tag="method"}
|
||||||
|
|
||||||
Learn from a batch of documents and gold-standard information, updating the
|
Learn from a batch of [`Example`](/api/example) objects containing the
|
||||||
pipe's model. Delegates to [`predict`](/api/textcategorizer#predict) and
|
predictions and gold-standard annotations, and update the component's model.
|
||||||
|
Delegates to [`predict`](/api/textcategorizer#predict) and
|
||||||
[`get_loss`](/api/textcategorizer#get_loss).
|
[`get_loss`](/api/textcategorizer#get_loss).
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
|
|
|
@ -145,7 +145,8 @@ Initialize the pipe for training, using data examples if available. Returns an
|
||||||
|
|
||||||
## Tok2Vec.predict {#predict tag="method"}
|
## Tok2Vec.predict {#predict tag="method"}
|
||||||
|
|
||||||
Apply the pipeline's model to a batch of docs, without modifying them.
|
Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
|
||||||
|
modifying them.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -161,7 +162,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
|
||||||
|
|
||||||
## Tok2Vec.set_annotations {#set_annotations tag="method"}
|
## Tok2Vec.set_annotations {#set_annotations tag="method"}
|
||||||
|
|
||||||
Modify a batch of documents, using pre-computed scores.
|
Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -178,8 +179,9 @@ Modify a batch of documents, using pre-computed scores.
|
||||||
|
|
||||||
## Tok2Vec.update {#update tag="method"}
|
## Tok2Vec.update {#update tag="method"}
|
||||||
|
|
||||||
Learn from a batch of documents and gold-standard information, updating the
|
Learn from a batch of [`Example`](/api/example) objects containing the
|
||||||
pipe's model. Delegates to [`predict`](/api/tok2vec#predict).
|
predictions and gold-standard annotations, and update the component's model.
|
||||||
|
Delegates to [`predict`](/api/tok2vec#predict).
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
|
|
@ -179,7 +179,8 @@ Initialize the pipe for training, using data examples if available. Returns an
|
||||||
|
|
||||||
## Transformer.predict {#predict tag="method"}
|
## Transformer.predict {#predict tag="method"}
|
||||||
|
|
||||||
Apply the pipeline's model to a batch of docs, without modifying them.
|
Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
|
||||||
|
modifying them.
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user