Skip to content

Commit

Permalink
further rename
Browse files Browse the repository at this point in the history
  • Loading branch information
svlandeg committed Apr 2, 2024
1 parent 1a2c379 commit d7a250d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spacy/pipeline/entity_linker.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def __init__(
if candidates_batch_size < 1:
raise ValueError(Errors.E1044)

def _score_augmented(examples: Iterable[Example], **kwargs):
def _score_with_ents_set(examples: Iterable[Example], **kwargs):
# Because of how spaCy works, we can't just score immediately, because Language.evaluate
# calls pipe() on the predicted docs, which won't have entities if there is no NER in the pipeline.
if not self.use_gold_ents:
Expand All @@ -255,7 +255,7 @@ def _score_augmented(examples: Iterable[Example], **kwargs):
eg.predicted = doc
return scorer(examples, **kwargs)

self.scorer = _score_augmented
self.scorer = _score_with_ents_set

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."""
Expand Down Expand Up @@ -401,9 +401,9 @@ def update(
return losses

def get_loss(self, examples: Iterable[Example], sentence_encodings: Floats2d):
"""Here, we assume that get_loss is called with augmented examples if need be"""
validate_examples(examples, "EntityLinker.get_loss")
entity_encodings = []
# We assume that get_loss is called with gold ents set in the examples if need be
eidx = 0 # indices in gold entities to keep
keep_ents = [] # indices in sentence_encodings to keep

Expand Down

0 comments on commit d7a250d

Please sign in to comment.