diff --git a/spacy/errors.py b/spacy/errors.py index 51a10be17..92770b8a8 100644 --- a/spacy/errors.py +++ b/spacy/errors.py @@ -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 " diff --git a/spacy/kb/kb.pyx b/spacy/kb/kb.pyx index ce4bc0138..158c3304f 100644 --- a/spacy/kb/kb.pyx +++ b/spacy/kb/kb.pyx @@ -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. diff --git a/spacy/kb/kb_in_memory.pyx b/spacy/kb/kb_in_memory.pyx index d456f729b..692390f10 100644 --- a/spacy/kb/kb_in_memory.pyx +++ b/spacy/kb/kb_in_memory.pyx @@ -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