mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-21 01:21:58 +03:00
Use type alias.
This commit is contained in:
parent
c8691a27d6
commit
f169614c53
|
@ -5,7 +5,6 @@ from libc.stdint cimport int64_t
|
|||
|
||||
from ..vocab cimport Vocab
|
||||
|
||||
|
||||
cdef class KnowledgeBase:
|
||||
cdef Pool mem
|
||||
cdef readonly Vocab vocab
|
||||
|
|
|
@ -9,6 +9,8 @@ from ..errors import Errors
|
|||
from ..tokens import SpanGroup
|
||||
from ..util import SimpleFrozenList
|
||||
from .candidate import Candidate
|
||||
from .typedefs import CandidatesForMention
|
||||
|
||||
|
||||
|
||||
cdef class KnowledgeBase:
|
||||
|
@ -32,7 +34,7 @@ cdef class KnowledgeBase:
|
|||
self.entity_vector_length = entity_vector_length
|
||||
self.mem = Pool()
|
||||
|
||||
def get_candidates(self, mentions: Iterator[SpanGroup]) -> Iterator[Iterable[Iterable[Candidate]]]:
|
||||
def get_candidates(self, mentions: Iterator[SpanGroup]) -> Iterator[Iterable[CandidatesForMention]]:
|
||||
"""
|
||||
Return candidate entities for a specified Span mention. Each candidate defines at least the entity and the
|
||||
entity's embedding vector. Depending on the KB implementation, further properties - such as the prior
|
||||
|
|
4
spacy/kb/typedefs.pxd
Normal file
4
spacy/kb/typedefs.pxd
Normal file
|
@ -0,0 +1,4 @@
|
|||
from .candidate import Candidate
|
||||
from typing import Iterable
|
||||
|
||||
ctypedef Iterable[Candidate] CandidatesForMention
|
Loading…
Reference in New Issue
Block a user