mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-23 23:20:52 +03:00
update EL docs
This commit is contained in:
parent
d862975f31
commit
17797764fa
|
@ -32,13 +32,13 @@ architectures and their arguments and hyperparameters.
|
||||||
> nlp.add_pipe("entity_linker", config=config)
|
> nlp.add_pipe("entity_linker", config=config)
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
| Setting | Type | Description | Default |
|
| Setting | Type | Description | Default |
|
||||||
| ---------------- | ------------------------------------------ | ----------------- | ----------------------------------------------- |
|
| ---------------- | ------------------------------------------ | ----------------------------------------------------------------------- | ----------------------------------------------- |
|
||||||
| `kb` | `KnowledgeBase` | <!-- TODO: --> | `None` |
|
| `kb` | `KnowledgeBase` | The [`KnowledgeBase`](/api/kb) holding all entities and their aliases. | `None` |
|
||||||
| `labels_discard` | `Iterable[str]` | <!-- TODO: --> | `[]` |
|
| `labels_discard` | `Iterable[str]` | NER labels that will automatically get a "NIL" prediction. | `[]` |
|
||||||
| `incl_prior` | bool | <!-- TODO: --> | `True` |
|
| `incl_prior` | bool | Whether or not to include prior probabilities from the KB in the model. | `True` |
|
||||||
| `incl_context` | bool | <!-- TODO: --> | `True` |
|
| `incl_context` | bool | Whether or not to include the local context in the model. | `True` |
|
||||||
| `model` | [`Model`](https://thinc.ai/docs/api-model) | The model to use. | [EntityLinker](/api/architectures#EntityLinker) |
|
| `model` | [`Model`](https://thinc.ai/docs/api-model) | The model to use. | [EntityLinker](/api/architectures#EntityLinker) |
|
||||||
|
|
||||||
```python
|
```python
|
||||||
https://github.com/explosion/spaCy/blob/develop/spacy/pipeline/entity_linker.py
|
https://github.com/explosion/spaCy/blob/develop/spacy/pipeline/entity_linker.py
|
||||||
|
@ -71,10 +71,10 @@ shortcut for this and instantiate the component using its string name and
|
||||||
| `model` | `Model` | The [`Model`](https://thinc.ai/docs/api-model) powering the pipeline component. |
|
| `model` | `Model` | The [`Model`](https://thinc.ai/docs/api-model) powering the pipeline component. |
|
||||||
| `name` | str | String name of the component instance. Used to add entries to the `losses` during training. |
|
| `name` | str | String name of the component instance. Used to add entries to the `losses` during training. |
|
||||||
| _keyword-only_ | | |
|
| _keyword-only_ | | |
|
||||||
| `kb` | `KnowlegeBase` | <!-- TODO: --> |
|
| `kb` | `KnowlegeBase` | The [`KnowledgeBase`](/api/kb) holding all entities and their aliases. |
|
||||||
| `labels_discard` | `Iterable[str]` | <!-- TODO: --> |
|
| `labels_discard` | `Iterable[str]` | NER labels that will automatically get a "NIL" prediction. |
|
||||||
| `incl_prior` | bool | <!-- TODO: --> |
|
| `incl_prior` | bool | Whether or not to include prior probabilities from the KB in the model. |
|
||||||
| `incl_context` | bool | <!-- TODO: --> |
|
| `incl_context` | bool | Whether or not to include the local context in the model. |
|
||||||
|
|
||||||
## EntityLinker.\_\_call\_\_ {#call tag="method"}
|
## EntityLinker.\_\_call\_\_ {#call tag="method"}
|
||||||
|
|
||||||
|
@ -126,15 +126,12 @@ applied to the `Doc` in order. Both [`__call__`](/api/entitylinker#call) and
|
||||||
## EntityLinker.begin_training {#begin_training tag="method"}
|
## EntityLinker.begin_training {#begin_training tag="method"}
|
||||||
|
|
||||||
Initialize the pipe for training, using data examples if available. Returns an
|
Initialize the pipe for training, using data examples if available. Returns an
|
||||||
[`Optimizer`](https://thinc.ai/docs/api-optimizers) object. Before calling this
|
[`Optimizer`](https://thinc.ai/docs/api-optimizers) object.
|
||||||
method, a knowledge base should have been defined with
|
|
||||||
[`set_kb`](/api/entitylinker#set_kb).
|
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
> ```python
|
> ```python
|
||||||
> entity_linker = nlp.add_pipe("entity_linker", last=True)
|
> entity_linker = nlp.add_pipe("entity_linker", last=True)
|
||||||
> entity_linker.set_kb(kb)
|
|
||||||
> optimizer = entity_linker.begin_training(pipeline=nlp.pipeline)
|
> optimizer = entity_linker.begin_training(pipeline=nlp.pipeline)
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
@ -206,22 +203,6 @@ pipe's entity linking model and context encoder. Delegates to
|
||||||
| `losses` | `Dict[str, float]` | Optional record of the loss during training. Updated using the component name as the key. |
|
| `losses` | `Dict[str, float]` | Optional record of the loss during training. Updated using the component name as the key. |
|
||||||
| **RETURNS** | `Dict[str, float]` | The updated `losses` dictionary. |
|
| **RETURNS** | `Dict[str, float]` | The updated `losses` dictionary. |
|
||||||
|
|
||||||
## EntityLinker.set_kb {#set_kb tag="method"}
|
|
||||||
|
|
||||||
Define the knowledge base (KB) used for disambiguating named entities to KB
|
|
||||||
identifiers.
|
|
||||||
|
|
||||||
> #### Example
|
|
||||||
>
|
|
||||||
> ```python
|
|
||||||
> entity_linker = nlp.add_pipe("entity_linker")
|
|
||||||
> entity_linker.set_kb(kb)
|
|
||||||
> ```
|
|
||||||
|
|
||||||
| Name | Type | Description |
|
|
||||||
| ---- | --------------- | ------------------------------- |
|
|
||||||
| `kb` | `KnowledgeBase` | The [`KnowledgeBase`](/api/kb). |
|
|
||||||
|
|
||||||
## EntityLinker.create_optimizer {#create_optimizer tag="method"}
|
## EntityLinker.create_optimizer {#create_optimizer tag="method"}
|
||||||
|
|
||||||
Create an optimizer for the pipeline component.
|
Create an optimizer for the pipeline component.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user