mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-22 10:02:01 +03:00
Update alias/mention usage in doc(strings).
This commit is contained in:
parent
be858981e6
commit
28dbed64cb
|
@ -49,7 +49,7 @@ cdef class InMemoryCandidate(Candidate):
|
|||
self,
|
||||
kb: InMemoryLookupKB,
|
||||
entity_hash: int,
|
||||
mention_hash: int,
|
||||
alias_hash: int,
|
||||
entity_vector: vector[float],
|
||||
prior_prob: float,
|
||||
entity_freq: float
|
||||
|
@ -59,9 +59,9 @@ cdef class InMemoryCandidate(Candidate):
|
|||
entity_id (int): Entity ID as hash that can be looked up with InMemoryKB.vocab.strings.__getitem__().
|
||||
entity_freq (int): Entity frequency in KB corpus.
|
||||
entity_vector (List[float]): Entity embedding.
|
||||
mention_hash (int): Mention hash.
|
||||
prior_prob (float): Prior probability of entity for this mention. I. e. the probability that, independent of
|
||||
the context, this mention - which matches one of this entity's aliases - resolves to one this entity.
|
||||
alias_hash (int): Alias hash.
|
||||
prior_prob (float): Prior probability of entity for this alias. I. e. the probability that, independent of
|
||||
the context, this alias - which matches one of this entity's aliases - resolves to one this entity.
|
||||
"""
|
||||
super().__init__()
|
||||
|
||||
|
@ -69,7 +69,7 @@ cdef class InMemoryCandidate(Candidate):
|
|||
self._entity_vector = entity_vector
|
||||
self._prior_prob = prior_prob
|
||||
self._kb = kb
|
||||
self._mention = mention_hash
|
||||
self._mention = alias_hash
|
||||
self._entity_freq = entity_freq
|
||||
|
||||
@property
|
||||
|
@ -82,7 +82,7 @@ cdef class InMemoryCandidate(Candidate):
|
|||
|
||||
@property
|
||||
def prior_prob(self) -> float:
|
||||
"""RETURNS (float): Prior probability that this mention, which matches one of this entity's aliases, resolves to
|
||||
"""RETURNS (float): Prior probability that this alias, which matches one of this entity's synonyms, resolves to
|
||||
this entity."""
|
||||
return self._prior_prob
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ cdef class InMemoryLookupKB(KnowledgeBase):
|
|||
InMemoryCandidate(
|
||||
kb=self,
|
||||
entity_hash=self._entries[entry_index].entity_hash,
|
||||
mention_hash=alias_hash,
|
||||
alias_hash=alias_hash,
|
||||
entity_vector=self._vectors_table[self._entries[entry_index].vector_index],
|
||||
prior_prob=prior_prob,
|
||||
entity_freq=self._entries[entry_index].freq
|
||||
|
|
|
@ -175,11 +175,11 @@ Restore the state of the knowledge base from a given directory. Note that the
|
|||
|
||||
## InMemoryCandidate {id="candidate",tag="class"}
|
||||
|
||||
An `InMemoryCandidate` object refers to a textual mention (alias) that may or may
|
||||
not be resolved to a specific entity from a `KnowledgeBase`. This will be used
|
||||
as input for the entity linking algorithm which will disambiguate the various
|
||||
candidates to the correct one. Each candidate `(alias, entity)` pair is assigned
|
||||
to a certain prior probability.
|
||||
An `InMemoryCandidate` object refers to a textual mention (alias) that may or
|
||||
may not be resolved to a specific entity from a `KnowledgeBase`. This will be
|
||||
used as input for the entity linking algorithm which will disambiguate the
|
||||
various candidates to the correct one. Each candidate `(alias, entity)` pair is
|
||||
assigned to a certain prior probability.
|
||||
|
||||
### InMemoryCandidate.\_\_init\_\_ {id="candidate-init",tag="method"}
|
||||
|
||||
|
@ -190,19 +190,19 @@ of the [`entity_linker`](/api/entitylinker) pipe.
|
|||
> #### Example```python
|
||||
>
|
||||
> from spacy.kb import InMemoryCandidate candidate = InMemoryCandidate(kb,
|
||||
> entity_hash, entity_freq, entity_vector, mention_hash, prior_prob)
|
||||
> entity_hash, entity_freq, entity_vector, alias_hash, prior_prob)
|
||||
>
|
||||
> ```
|
||||
>
|
||||
> ```
|
||||
|
||||
| Name | Description |
|
||||
| -------------- | ------------------------------------------------------------------------- |
|
||||
| `kb` | The knowledge base that defined this candidate. ~~KnowledgeBase~~ |
|
||||
| `entity_hash` | The hash of the entity's KB ID. ~~int~~ |
|
||||
| `entity_freq` | The entity frequency as recorded in the KB. ~~float~~ |
|
||||
| `mention_hash` | The hash of the textual mention. ~~int~~ |
|
||||
| `prior_prob` | The prior probability of the `alias` referring to the `entity`. ~~float~~ |
|
||||
| Name | Description |
|
||||
| ------------- | ------------------------------------------------------------------------- |
|
||||
| `kb` | The knowledge base that defined this candidate. ~~KnowledgeBase~~ |
|
||||
| `entity_hash` | The hash of the entity's KB ID. ~~int~~ |
|
||||
| `entity_freq` | The entity frequency as recorded in the KB. ~~float~~ |
|
||||
| `alias_hash` | The hash of the entity alias. ~~int~~ |
|
||||
| `prior_prob` | The prior probability of the `alias` referring to the `entity`. ~~float~~ |
|
||||
|
||||
## InMemoryCandidate attributes {id="candidate-attributes"}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user