mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-13 17:52:31 +03:00
Update docs
This commit is contained in:
parent
2d9ca0cd8b
commit
4498dfe99d
|
@ -296,15 +296,13 @@ component function.
|
||||||
Disable one or more pipeline components. If used as a context manager, the
|
Disable one or more pipeline components. If used as a context manager, the
|
||||||
pipeline will be restored to the initial state at the end of the block.
|
pipeline will be restored to the initial state at the end of the block.
|
||||||
Otherwise, a `DisabledPipes` object is returned, that has a `.restore()` method
|
Otherwise, a `DisabledPipes` object is returned, that has a `.restore()` method
|
||||||
you can use to undo your changes.
|
you can use to undo your changes. You can specify either `disable` (as a list or
|
||||||
|
string), or `enable`. In the latter case, all components not in the `enable`
|
||||||
You can specify either `disable` (as a list or string), or `enable`. In the
|
list, will be disabled.
|
||||||
latter case, all components not in the `enable` list, will be disabled.
|
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
> ```python
|
> ```python
|
||||||
> # New API as of v3.0
|
|
||||||
> with nlp.select_pipes(disable=["tagger", "parser"]):
|
> with nlp.select_pipes(disable=["tagger", "parser"]):
|
||||||
> nlp.begin_training()
|
> nlp.begin_training()
|
||||||
>
|
>
|
||||||
|
@ -316,15 +314,7 @@ latter case, all components not in the `enable` list, will be disabled.
|
||||||
> disabled.restore()
|
> disabled.restore()
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
| Name | Type | Description |
|
<Infobox title="Changed in v3.0" variant="warning" id="disable_pipes">
|
||||||
| ----------- | --------------- | ------------------------------------------------------------------------------------ |
|
|
||||||
| `disable` | list | Names of pipeline components to disable. |
|
|
||||||
| `disable` | str | Name of pipeline component to disable. |
|
|
||||||
| `enable` | list | Names of pipeline components that will not be disabled. |
|
|
||||||
| `enable` | str | Name of pipeline component that will not be disabled. |
|
|
||||||
| **RETURNS** | `DisabledPipes` | The disabled pipes that can be restored by calling the object's `.restore()` method. |
|
|
||||||
|
|
||||||
<Infobox title="Changed in v3.0" variant="warning">
|
|
||||||
|
|
||||||
As of spaCy v3.0, the `disable_pipes` method has been renamed to `select_pipes`:
|
As of spaCy v3.0, the `disable_pipes` method has been renamed to `select_pipes`:
|
||||||
|
|
||||||
|
@ -335,6 +325,12 @@ As of spaCy v3.0, the `disable_pipes` method has been renamed to `select_pipes`:
|
||||||
|
|
||||||
</Infobox>
|
</Infobox>
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
| ----------- | --------------- | ------------------------------------------------------------------------------------ |
|
||||||
|
| `disable` | str / list | Name(s) of pipeline components to disable. |
|
||||||
|
| `enable` | str / list | Names(s) of pipeline components that will not be disabled. |
|
||||||
|
| **RETURNS** | `DisabledPipes` | The disabled pipes that can be restored by calling the object's `.restore()` method. |
|
||||||
|
|
||||||
## Language.to_disk {#to_disk tag="method" new="2"}
|
## Language.to_disk {#to_disk tag="method" new="2"}
|
||||||
|
|
||||||
Save the current state to a directory. If a model is loaded, this will **include
|
Save the current state to a directory. If a model is loaded, this will **include
|
||||||
|
|
|
@ -698,72 +698,11 @@ vary on each step.
|
||||||
> nlp.update(texts, annotations)
|
> nlp.update(texts, annotations)
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
| ---------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ---------- | -------------- | ---------------------- |
|
||||||
| `items` | iterable | The items to batch up. |
|
| `items` | iterable | The items to batch up. |
|
||||||
| `size` | int / iterable | The batch size(s). Use [`util.compounding`](/api/top-level#util.compounding) or [`util.decaying`](/api/top-level#util.decaying) or for an infinite series of compounding or decaying values. |
|
| `size` | int / iterable | The batch size(s). |
|
||||||
| **YIELDS** | list | The batches. |
|
| **YIELDS** | list | The batches. |
|
||||||
|
|
||||||
### util.compounding {#util.compounding tag="function" new="2"}
|
|
||||||
|
|
||||||
Yield an infinite series of compounding values. Each time the generator is
|
|
||||||
called, a value is produced by multiplying the previous value by the compound
|
|
||||||
rate.
|
|
||||||
|
|
||||||
> #### Example
|
|
||||||
>
|
|
||||||
> ```python
|
|
||||||
> sizes = compounding(1., 10., 1.5)
|
|
||||||
> assert next(sizes) == 1.
|
|
||||||
> assert next(sizes) == 1. * 1.5
|
|
||||||
> assert next(sizes) == 1.5 * 1.5
|
|
||||||
> ```
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---------- | ----------- | ----------------------- |
|
|
||||||
| `start` | int / float | The first value. |
|
|
||||||
| `stop` | int / float | The maximum value. |
|
|
||||||
| `compound` | int / float | The compounding factor. |
|
|
||||||
| **YIELDS** | int | Compounding values. |
|
|
||||||
|
|
||||||
### util.decaying {#util.decaying tag="function" new="2"}
|
|
||||||
|
|
||||||
Yield an infinite series of linearly decaying values.
|
|
||||||
|
|
||||||
> #### Example
|
|
||||||
>
|
|
||||||
> ```python
|
|
||||||
> sizes = decaying(10., 1., 0.001)
|
|
||||||
> assert next(sizes) == 10.
|
|
||||||
> assert next(sizes) == 10. - 0.001
|
|
||||||
> assert next(sizes) == 9.999 - 0.001
|
|
||||||
> ```
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---------- | ----------- | -------------------- |
|
|
||||||
| `start` | int / float | The first value. |
|
|
||||||
| `end` | int / float | The maximum value. |
|
|
||||||
| `decay` | int / float | The decaying factor. |
|
|
||||||
| **YIELDS** | int | The decaying values. |
|
|
||||||
|
|
||||||
### util.itershuffle {#util.itershuffle tag="function" new="2"}
|
|
||||||
|
|
||||||
Shuffle an iterator. This works by holding `bufsize` items back and yielding
|
|
||||||
them sometime later. Obviously, this is not unbiased – but should be good enough
|
|
||||||
for batching. Larger `bufsize` means less bias.
|
|
||||||
|
|
||||||
> #### Example
|
|
||||||
>
|
|
||||||
> ```python
|
|
||||||
> values = range(1000)
|
|
||||||
> shuffled = itershuffle(values)
|
|
||||||
> ```
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---------- | -------- | ----------------------------------- |
|
|
||||||
| `iterable` | iterable | Iterator to shuffle. |
|
|
||||||
| `bufsize` | int | Items to hold back (default: 1000). |
|
|
||||||
| **YIELDS** | iterable | The shuffled iterator. |
|
|
||||||
|
|
||||||
### util.filter_spans {#util.filter_spans tag="function" new="2.1.4"}
|
### util.filter_spans {#util.filter_spans tag="function" new="2.1.4"}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user