mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 16:22:29 +03:00
Update docstring and type usage.
This commit is contained in:
parent
6401856594
commit
d6c7636069
|
@ -36,9 +36,10 @@ cdef class KnowledgeBase:
|
||||||
|
|
||||||
def get_candidates(self, mentions: Iterator[SpanGroup]) -> Iterator[CandidatesForDocT]:
|
def get_candidates(self, mentions: Iterator[SpanGroup]) -> Iterator[CandidatesForDocT]:
|
||||||
"""
|
"""
|
||||||
Return candidate entities for a specified Span mention. Each candidate defines at least the entity and the
|
Return candidate entities for the specified groups of mentions (as SpanGroup) per Doc.
|
||||||
entity's embedding vector. Depending on the KB implementation, further properties - such as the prior
|
Each candidate for a mention defines at least the entity and the entity's embedding vector. Depending on the KB
|
||||||
probability of the specified mention text resolving to that entity - might be included.
|
implementation, further properties - such as the prior probability of the specified mention text resolving to
|
||||||
|
that entity - might be included.
|
||||||
If no candidates are found for a given mention, an empty list is returned.
|
If no candidates are found for a given mention, an empty list is returned.
|
||||||
mentions (Iterator[SpanGroup]): Mentions for which to get candidates.
|
mentions (Iterator[SpanGroup]): Mentions for which to get candidates.
|
||||||
RETURNS (Iterator[Iterable[Iterable[Candidate]]]): Identified candidates per mention/doc/doc batch.
|
RETURNS (Iterator[Iterable[Iterable[Candidate]]]): Identified candidates per mention/doc/doc batch.
|
||||||
|
|
|
@ -21,6 +21,9 @@ from ...util import registry
|
||||||
from ...vocab import Vocab
|
from ...vocab import Vocab
|
||||||
from ..extract_spans import extract_spans
|
from ..extract_spans import extract_spans
|
||||||
|
|
||||||
|
CandidatesForMentionT = Iterable[Candidate]
|
||||||
|
CandidatesForDocT = Iterable[CandidatesForMentionT]
|
||||||
|
|
||||||
|
|
||||||
@registry.architectures("spacy.EntityLinker.v2")
|
@registry.architectures("spacy.EntityLinker.v2")
|
||||||
def build_nel_encoder(
|
def build_nel_encoder(
|
||||||
|
@ -118,8 +121,7 @@ def empty_kb(
|
||||||
|
|
||||||
@registry.misc("spacy.CandidateGenerator.v1")
|
@registry.misc("spacy.CandidateGenerator.v1")
|
||||||
def create_get_candidates() -> Callable[
|
def create_get_candidates() -> Callable[
|
||||||
[KnowledgeBase, Iterator[SpanGroup]],
|
[KnowledgeBase, Iterator[SpanGroup]], Iterator[CandidatesForDocT]
|
||||||
Iterator[Iterable[Iterable[Candidate]]],
|
|
||||||
]:
|
]:
|
||||||
return get_candidates
|
return get_candidates
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user