mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-27 09:44:36 +03:00
API docs: Rename kb_in_memory to inmemorylookupkb, add to sidebar (#12128)
* API docs: Rename kb_in_memory to inmemorylookupkb, add to sidebar * adjust to mdx * linkout to InMemoryLookupKB at first occurrence in kb.mdx * fix links to docs * revert Azure trigger setting (I'll make a separate PR) Co-authored-by: svlandeg <svlandeg@github.com>
This commit is contained in:
parent
a9910b6081
commit
3b8918e166
|
@ -25,7 +25,7 @@ cdef class InMemoryLookupKB(KnowledgeBase):
|
||||||
"""An `InMemoryLookupKB` instance stores unique identifiers for entities and their textual aliases,
|
"""An `InMemoryLookupKB` instance stores unique identifiers for entities and their textual aliases,
|
||||||
to support entity linking of named entities to real-world concepts.
|
to support entity linking of named entities to real-world concepts.
|
||||||
|
|
||||||
DOCS: https://spacy.io/api/kb_in_memory
|
DOCS: https://spacy.io/api/inmemorylookupkb
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, Vocab vocab, entity_vector_length):
|
def __init__(self, Vocab vocab, entity_vector_length):
|
||||||
|
|
|
@ -15,7 +15,7 @@ world". It requires a `KnowledgeBase`, as well as a function to generate
|
||||||
plausible candidates from that `KnowledgeBase` given a certain textual mention,
|
plausible candidates from that `KnowledgeBase` given a certain textual mention,
|
||||||
and a machine learning model to pick the right candidate, given the local
|
and a machine learning model to pick the right candidate, given the local
|
||||||
context of the mention. `EntityLinker` defaults to using the
|
context of the mention. `EntityLinker` defaults to using the
|
||||||
[`InMemoryLookupKB`](/api/kb_in_memory) implementation.
|
[`InMemoryLookupKB`](/api/inmemorylookupkb) implementation.
|
||||||
|
|
||||||
## Assigned Attributes {id="assigned-attributes"}
|
## Assigned Attributes {id="assigned-attributes"}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ The length of the fixed-size entity vectors in the knowledge base.
|
||||||
|
|
||||||
Add an entity to the knowledge base, specifying its corpus frequency and entity
|
Add an entity to the knowledge base, specifying its corpus frequency and entity
|
||||||
vector, which should be of length
|
vector, which should be of length
|
||||||
[`entity_vector_length`](/api/kb_in_memory#entity_vector_length).
|
[`entity_vector_length`](/api/inmemorylookupkb#entity_vector_length).
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -79,8 +79,9 @@ frequency and entity vector for each entity.
|
||||||
|
|
||||||
Add an alias or mention to the knowledge base, specifying its potential KB
|
Add an alias or mention to the knowledge base, specifying its potential KB
|
||||||
identifiers and their prior probabilities. The entity identifiers should refer
|
identifiers and their prior probabilities. The entity identifiers should refer
|
||||||
to entities previously added with [`add_entity`](/api/kb_in_memory#add_entity)
|
to entities previously added with
|
||||||
or [`set_entities`](/api/kb_in_memory#set_entities). The sum of the prior
|
[`add_entity`](/api/inmemorylookupkb#add_entity) or
|
||||||
|
[`set_entities`](/api/inmemorylookupkb#set_entities). The sum of the prior
|
||||||
probabilities should not exceed 1. Note that an empty string can not be used as
|
probabilities should not exceed 1. Note that an empty string can not be used as
|
||||||
alias.
|
alias.
|
||||||
|
|
||||||
|
@ -156,7 +157,7 @@ Get a list of all aliases in the knowledge base.
|
||||||
|
|
||||||
Given a certain textual mention as input, retrieve a list of candidate entities
|
Given a certain textual mention as input, retrieve a list of candidate entities
|
||||||
of type [`Candidate`](/api/kb#candidate). Wraps
|
of type [`Candidate`](/api/kb#candidate). Wraps
|
||||||
[`get_alias_candidates()`](/api/kb_in_memory#get_alias_candidates).
|
[`get_alias_candidates()`](/api/inmemorylookupkb#get_alias_candidates).
|
||||||
|
|
||||||
> #### Example
|
> #### Example
|
||||||
>
|
>
|
||||||
|
@ -174,7 +175,7 @@ of type [`Candidate`](/api/kb#candidate). Wraps
|
||||||
|
|
||||||
## InMemoryLookupKB.get_candidates_batch {id="get_candidates_batch",tag="method"}
|
## InMemoryLookupKB.get_candidates_batch {id="get_candidates_batch",tag="method"}
|
||||||
|
|
||||||
Same as [`get_candidates()`](/api/kb_in_memory#get_candidates), but for an
|
Same as [`get_candidates()`](/api/inmemorylookupkb#get_candidates), but for an
|
||||||
arbitrary number of mentions. The [`EntityLinker`](/api/entitylinker) component
|
arbitrary number of mentions. The [`EntityLinker`](/api/entitylinker) component
|
||||||
will call `get_candidates_batch()` instead of `get_candidates()`, if the config
|
will call `get_candidates_batch()` instead of `get_candidates()`, if the config
|
||||||
parameter `candidates_batch_size` is greater or equal than 1.
|
parameter `candidates_batch_size` is greater or equal than 1.
|
||||||
|
@ -231,7 +232,7 @@ Given a certain entity ID, retrieve its pretrained entity vector.
|
||||||
|
|
||||||
## InMemoryLookupKB.get_vectors {id="get_vectors",tag="method"}
|
## InMemoryLookupKB.get_vectors {id="get_vectors",tag="method"}
|
||||||
|
|
||||||
Same as [`get_vector()`](/api/kb_in_memory#get_vector), but for an arbitrary
|
Same as [`get_vector()`](/api/inmemorylookupkb#get_vector), but for an arbitrary
|
||||||
number of entity IDs.
|
number of entity IDs.
|
||||||
|
|
||||||
The default implementation of `get_vectors()` executes `get_vector()` in a loop.
|
The default implementation of `get_vectors()` executes `get_vector()` in a loop.
|
|
@ -21,8 +21,8 @@ functions called by the [`EntityLinker`](/api/entitylinker) component.
|
||||||
<Infobox variant="warning">
|
<Infobox variant="warning">
|
||||||
|
|
||||||
This class was not abstract up to spaCy version 3.5. The `KnowledgeBase`
|
This class was not abstract up to spaCy version 3.5. The `KnowledgeBase`
|
||||||
implementation up to that point is available as `InMemoryLookupKB` from 3.5
|
implementation up to that point is available as
|
||||||
onwards.
|
[`InMemoryLookupKB`](/api/inmemorylookupkb) from 3.5 onwards.
|
||||||
|
|
||||||
</Infobox>
|
</Infobox>
|
||||||
|
|
||||||
|
@ -110,14 +110,15 @@ to you.
|
||||||
</Infobox>
|
</Infobox>
|
||||||
|
|
||||||
From spaCy 3.5 on `KnowledgeBase` is an abstract class (with
|
From spaCy 3.5 on `KnowledgeBase` is an abstract class (with
|
||||||
[`InMemoryLookupKB`](/api/kb_in_memory) being a drop-in replacement) to allow
|
[`InMemoryLookupKB`](/api/inmemorylookupkb) being a drop-in replacement) to
|
||||||
more flexibility in customizing knowledge bases. Some of its methods were moved
|
allow more flexibility in customizing knowledge bases. Some of its methods were
|
||||||
to [`InMemoryLookupKB`](/api/kb_in_memory) during this refactoring, one of those
|
moved to [`InMemoryLookupKB`](/api/inmemorylookupkb) during this refactoring,
|
||||||
being `get_alias_candidates()`. This method is now available as
|
one of those being `get_alias_candidates()`. This method is now available as
|
||||||
[`InMemoryLookupKB.get_alias_candidates()`](/api/kb_in_memory#get_alias_candidates).
|
[`InMemoryLookupKB.get_alias_candidates()`](/api/inmemorylookupkb#get_alias_candidates).
|
||||||
Note: [`InMemoryLookupKB.get_candidates()`](/api/kb_in_memory#get_candidates)
|
Note:
|
||||||
|
[`InMemoryLookupKB.get_candidates()`](/api/inmemorylookupkb#get_candidates)
|
||||||
defaults to
|
defaults to
|
||||||
[`InMemoryLookupKB.get_alias_candidates()`](/api/kb_in_memory#get_alias_candidates).
|
[`InMemoryLookupKB.get_alias_candidates()`](/api/inmemorylookupkb#get_alias_candidates).
|
||||||
|
|
||||||
## KnowledgeBase.get_vector {id="get_vector",tag="method"}
|
## KnowledgeBase.get_vector {id="get_vector",tag="method"}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ operates on a `Doc` and gives you access to the matched tokens **in context**.
|
||||||
| ------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
|
| ------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
|
||||||
| [`Corpus`](/api/corpus) | Class for managing annotated corpora for training and evaluation data. |
|
| [`Corpus`](/api/corpus) | Class for managing annotated corpora for training and evaluation data. |
|
||||||
| [`KnowledgeBase`](/api/kb) | Abstract base class for storage and retrieval of data for entity linking. |
|
| [`KnowledgeBase`](/api/kb) | Abstract base class for storage and retrieval of data for entity linking. |
|
||||||
| [`InMemoryLookupKB`](/api/kb_in_memory) | Implementation of `KnowledgeBase` storing all data in memory. |
|
| [`InMemoryLookupKB`](/api/inmemorylookupkb) | Implementation of `KnowledgeBase` storing all data in memory. |
|
||||||
| [`Candidate`](/api/kb#candidate) | Object associating a textual mention with a specific entity contained in a `KnowledgeBase`. |
|
| [`Candidate`](/api/kb#candidate) | Object associating a textual mention with a specific entity contained in a `KnowledgeBase`. |
|
||||||
| [`Lookups`](/api/lookups) | Container for convenient access to large lookup tables and dictionaries. |
|
| [`Lookups`](/api/lookups) | Container for convenient access to large lookup tables and dictionaries. |
|
||||||
| [`MorphAnalysis`](/api/morphology#morphanalysis) | A morphological analysis. |
|
| [`MorphAnalysis`](/api/morphology#morphanalysis) | A morphological analysis. |
|
||||||
|
|
|
@ -129,6 +129,7 @@
|
||||||
"items": [
|
"items": [
|
||||||
{ "text": "Attributes", "url": "/api/attributes" },
|
{ "text": "Attributes", "url": "/api/attributes" },
|
||||||
{ "text": "Corpus", "url": "/api/corpus" },
|
{ "text": "Corpus", "url": "/api/corpus" },
|
||||||
|
{ "text": "InMemoryLookupKB", "url": "/api/inmemorylookupkb" },
|
||||||
{ "text": "KnowledgeBase", "url": "/api/kb" },
|
{ "text": "KnowledgeBase", "url": "/api/kb" },
|
||||||
{ "text": "Lookups", "url": "/api/lookups" },
|
{ "text": "Lookups", "url": "/api/lookups" },
|
||||||
{ "text": "MorphAnalysis", "url": "/api/morphology#morphanalysis" },
|
{ "text": "MorphAnalysis", "url": "/api/morphology#morphanalysis" },
|
||||||
|
|
Loading…
Reference in New Issue
Block a user