Drop valid_ent_idx_per_doc.

This commit is contained in:
Raphael Mitsch 2023-04-24 21:15:30 +02:00
parent 40e3acacda
commit ee5d7f4a33

View File

@ -436,16 +436,6 @@ class EntityLinker(TrainablePipe):
docs = [docs]
docs = list(docs)
# Determine which entities are to be ignored due to labels_discard.
valid_ent_idx_per_doc = (
[
idx
for idx in range(len(doc.ents))
if doc.ents[idx].label_ not in self.labels_discard
]
for doc in docs
if len(doc) and len(doc.ents)
)
# Call candidate generator.
all_ent_cands = self.get_candidates(
@ -453,7 +443,7 @@ class EntityLinker(TrainablePipe):
(
SpanGroup(
doc,
spans=[doc.ents[idx] for idx in next(valid_ent_idx_per_doc)],
spans=[ent for ent in doc.ents if ent.label_ not in self.labels_discard],
)
for doc in docs
if len(doc) and len(doc.ents)