Rename 'alias' to 'mention'.

This commit is contained in:
Raphael Mitsch 2023-03-09 12:06:15 +01:00
parent 1ba2fc4207
commit 1c937db3af
3 changed files with 8 additions and 8 deletions

View File

@ -82,7 +82,7 @@ class Warnings(metaclass=ErrorsWithCodes):
"ignoring the duplicate entry.")
W021 = ("Unexpected hash collision in PhraseMatcher. Matches may be "
"incorrect. Modify PhraseMatcher._terminal_hash to fix.")
W024 = ("Entity '{entity}' - Alias '{alias}' combination already exists in "
W024 = ("Entity '{entity}' - mention '{mention}' combination already exists in "
"the Knowledge Base.")
W026 = ("Unable to set all sentence boundaries from dependency parses. If "
"you are constructing a parse tree incrementally by setting "

View File

@ -11,7 +11,7 @@ from ..errors import Errors
cdef class KnowledgeBase:
"""A `KnowledgeBase` instance stores unique identifiers for entities and their textual aliases,
"""A `KnowledgeBase` instance stores unique identifiers for entities and their textual mentions,
to support entity linking of named entities to real-world concepts.
This is an abstract class and requires its operations to be implemented.
@ -32,8 +32,8 @@ cdef class KnowledgeBase:
def get_candidates_batch(self, mentions: Iterable[Span]) -> Iterable[Iterable[Candidate]]:
"""
Return candidate entities for specified texts. Each candidate defines the entity, the original alias,
and the prior probability of that alias resolving to that entity.
Return candidate entities for specified texts. Each candidate defines the entity, the original mention,
and the prior probability of this mention resolving to that entity.
If no candidate is found for a given text, an empty list is returned.
mentions (Iterable[Span]): Mentions for which to get candidates.
RETURNS (Iterable[Iterable[Candidate]]): Identified candidates.
@ -42,8 +42,8 @@ cdef class KnowledgeBase:
def get_candidates(self, mention: Span) -> Iterable[Candidate]:
"""
Return candidate entities for specified text. Each candidate defines the entity, the original alias,
and the prior probability of that alias resolving to that entity.
Return candidate entities for specified text. Each candidate defines the entity, the original mention,
and the prior probability of that mention resolving to that entity.
If the no candidate is found for a given text, an empty list is returned.
mention (Span): Mention for which to get candidates.
RETURNS (Iterable[Candidate]): Identified candidates.

View File

@ -22,7 +22,7 @@ from .candidate import InMemoryCandidate
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 mentions,
to support entity linking of named entities to real-world concepts.
DOCS: https://spacy.io/api/inmemorylookupkb
@ -216,7 +216,7 @@ cdef class InMemoryLookupKB(KnowledgeBase):
if is_present:
if not ignore_warnings:
warnings.warn(Warnings.W024.format(entity=entity, alias=alias))
warnings.warn(Warnings.W024.format(entity=entity, mention=alias))
else:
entry_indices.push_back(int(entry_index))
alias_entry.entry_indices = entry_indices