mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
document individual component API pages
This commit is contained in:
parent
a8aa9a8068
commit
c89e07927e
|
@ -307,6 +307,32 @@ Add a new label to the pipe.
|
|||
| `label` | The label to add. ~~str~~ |
|
||||
| **RETURNS** | `0` if the label is already present, otherwise `1`. ~~int~~ |
|
||||
|
||||
Note that you don't have to call `pipe.add_label` if you provide a
|
||||
representative data sample to the [`begin_training`](#begin_training) method. In
|
||||
this case, all labels found in the sample will be automatically added to the
|
||||
model, and the output dimension will be
|
||||
[inferred](/usage/layers-architectures#shape-inference) automatically.
|
||||
|
||||
## DependencyParser.set_output {#set_output tag="method"}
|
||||
|
||||
Change the output dimension of the component's model by calling the model's
|
||||
attribute `resize_output`. This is a function that takes the original model and
|
||||
the new output dimension `nO`, and changes the model in place.
|
||||
|
||||
> #### Example
|
||||
>
|
||||
> ```python
|
||||
> parser = nlp.add_pipe("parser")
|
||||
> parser.set_output(512)
|
||||
> ```
|
||||
|
||||
| Name | Description |
|
||||
| ---- | --------------------------------- |
|
||||
| `nO` | The new output dimension. ~~int~~ |
|
||||
|
||||
When resizing an already trained model, care should be taken to avoid the
|
||||
"catastrophic forgetting" problem.
|
||||
|
||||
## DependencyParser.to_disk {#to_disk tag="method"}
|
||||
|
||||
Serialize the pipe to disk.
|
||||
|
|
|
@ -295,6 +295,32 @@ Add a new label to the pipe.
|
|||
| `label` | The label to add. ~~str~~ |
|
||||
| **RETURNS** | `0` if the label is already present, otherwise `1`. ~~int~~ |
|
||||
|
||||
Note that you don't have to call `pipe.add_label` if you provide a
|
||||
representative data sample to the [`begin_training`](#begin_training) method. In
|
||||
this case, all labels found in the sample will be automatically added to the
|
||||
model, and the output dimension will be
|
||||
[inferred](/usage/layers-architectures#shape-inference) automatically.
|
||||
|
||||
## EntityRecognizer.set_output {#set_output tag="method"}
|
||||
|
||||
Change the output dimension of the component's model by calling the model's
|
||||
attribute `resize_output`. This is a function that takes the original model and
|
||||
the new output dimension `nO`, and changes the model in place.
|
||||
|
||||
> #### Example
|
||||
>
|
||||
> ```python
|
||||
> ner = nlp.add_pipe("ner")
|
||||
> ner.set_output(512)
|
||||
> ```
|
||||
|
||||
| Name | Description |
|
||||
| ---- | --------------------------------- |
|
||||
| `nO` | The new output dimension. ~~int~~ |
|
||||
|
||||
When resizing an already trained model, care should be taken to avoid the
|
||||
"catastrophic forgetting" problem.
|
||||
|
||||
## EntityRecognizer.to_disk {#to_disk tag="method"}
|
||||
|
||||
Serialize the pipe to disk.
|
||||
|
|
|
@ -258,6 +258,8 @@ context, the original parameters are restored.
|
|||
|
||||
Add a new label to the pipe. If the `Morphologizer` should set annotations for
|
||||
both `pos` and `morph`, the label should include the UPOS as the feature `POS`.
|
||||
Raises an error if the output dimension is already set, or if the model has
|
||||
already been fully [initialized](#begin_training).
|
||||
|
||||
> #### Example
|
||||
>
|
||||
|
@ -271,6 +273,12 @@ both `pos` and `morph`, the label should include the UPOS as the feature `POS`.
|
|||
| `label` | The label to add. ~~str~~ |
|
||||
| **RETURNS** | `0` if the label is already present, otherwise `1`. ~~int~~ |
|
||||
|
||||
Note that you don't have to call `pipe.add_label` if you provide a
|
||||
representative data sample to the [`begin_training`](#begin_training) method. In
|
||||
this case, all labels found in the sample will be automatically added to the
|
||||
model, and the output dimension will be
|
||||
[inferred](/usage/layers-architectures#shape-inference) automatically.
|
||||
|
||||
## Morphologizer.to_disk {#to_disk tag="method"}
|
||||
|
||||
Serialize the pipe to disk.
|
||||
|
|
|
@ -249,9 +249,9 @@ Score a batch of examples.
|
|||
> scores = tagger.score(examples)
|
||||
> ```
|
||||
|
||||
| Name | Description |
|
||||
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `examples` | The examples to score. ~~Iterable[Example]~~ |
|
||||
| Name | Description |
|
||||
| ----------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `examples` | The examples to score. ~~Iterable[Example]~~ |
|
||||
| **RETURNS** | The scores, produced by [`Scorer.score_token_attr`](/api/scorer#score_token_attr) for the attribute `"tag"`. ~~Dict[str, float]~~ |
|
||||
|
||||
## Tagger.create_optimizer {#create_optimizer tag="method"}
|
||||
|
@ -288,7 +288,8 @@ context, the original parameters are restored.
|
|||
|
||||
## Tagger.add_label {#add_label tag="method"}
|
||||
|
||||
Add a new label to the pipe.
|
||||
Add a new label to the pipe. Raises an error if the output dimension is already
|
||||
set, or if the model has already been fully [initialized](#begin_training).
|
||||
|
||||
> #### Example
|
||||
>
|
||||
|
@ -302,6 +303,12 @@ Add a new label to the pipe.
|
|||
| `label` | The label to add. ~~str~~ |
|
||||
| **RETURNS** | `0` if the label is already present, otherwise `1`. ~~int~~ |
|
||||
|
||||
Note that you don't have to call `pipe.add_label` if you provide a
|
||||
representative data sample to the [`begin_training`](#begin_training) method. In
|
||||
this case, all labels found in the sample will be automatically added to the
|
||||
model, and the output dimension will be
|
||||
[inferred](/usage/layers-architectures#shape-inference) automatically.
|
||||
|
||||
## Tagger.to_disk {#to_disk tag="method"}
|
||||
|
||||
Serialize the pipe to disk.
|
||||
|
|
|
@ -297,7 +297,8 @@ Modify the pipe's model, to use the given parameter values.
|
|||
|
||||
## TextCategorizer.add_label {#add_label tag="method"}
|
||||
|
||||
Add a new label to the pipe.
|
||||
Add a new label to the pipe. Raises an error if the output dimension is already
|
||||
set, or if the model has already been fully [initialized](#begin_training).
|
||||
|
||||
> #### Example
|
||||
>
|
||||
|
@ -311,6 +312,12 @@ Add a new label to the pipe.
|
|||
| `label` | The label to add. ~~str~~ |
|
||||
| **RETURNS** | `0` if the label is already present, otherwise `1`. ~~int~~ |
|
||||
|
||||
Note that you don't have to call `pipe.add_label` if you provide a
|
||||
representative data sample to the [`begin_training`](#begin_training) method. In
|
||||
this case, all labels found in the sample will be automatically added to the
|
||||
model, and the output dimension will be
|
||||
[inferred](/usage/layers-architectures#shape-inference) automatically.
|
||||
|
||||
## TextCategorizer.to_disk {#to_disk tag="method"}
|
||||
|
||||
Serialize the pipe to disk.
|
||||
|
|
Loading…
Reference in New Issue
Block a user