Skip to content

Commit

Permalink
rename to _ensure_ents
Browse files Browse the repository at this point in the history
  • Loading branch information
svlandeg committed Apr 2, 2024
1 parent ce7b51e commit 1a2c379
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions spacy/pipeline/entity_linker.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def _score_augmented(examples: Iterable[Example], **kwargs):
if not self.use_gold_ents:
return scorer(examples, **kwargs)
else:
examples = self._augment_examples(examples)
examples = self._ensure_ents(examples)
docs = self.pipe(
(eg.predicted for eg in examples),
)
Expand All @@ -257,7 +257,7 @@ def _score_augmented(examples: Iterable[Example], **kwargs):

self.scorer = _score_augmented

def _augment_examples(self, examples: Iterable[Example]) -> Iterable[Example]:
def _ensure_ents(self, examples: Iterable[Example]) -> Iterable[Example]:
"""If use_gold_ents is true, set the gold entities to (a copy of) eg.predicted."""
if not self.use_gold_ents:
return examples
Expand Down Expand Up @@ -311,7 +311,7 @@ def initialize(
nO = self.kb.entity_vector_length
doc_sample = []
vector_sample = []
examples = self._augment_examples(islice(get_examples(), 10))
examples = self._ensure_ents(islice(get_examples(), 10))
for eg in examples:
doc = eg.x
doc_sample.append(doc)
Expand Down Expand Up @@ -379,7 +379,7 @@ def update(
losses.setdefault(self.name, 0.0)
if not examples:
return losses
examples = self._augment_examples(examples)
examples = self._ensure_ents(examples)
validate_examples(examples, "EntityLinker.update")

# make sure we have something to learn from, if not, short-circuit
Expand Down

0 comments on commit 1a2c379

Please sign in to comment.