Fix bug in check for doc NEL viability.

This commit is contained in:
Raphael Mitsch 2022-10-23 18:32:55 +02:00
parent 9c69c3c313
commit f5f20b0b92

View File

@ -467,7 +467,7 @@ class EntityLinker(TrainablePipe):
if doc.ents[idx].label_ not in self.labels_discard if doc.ents[idx].label_ not in self.labels_discard
] ]
for doc in docs for doc in docs
if len(doc.ents) if len(doc) and len(doc.ents)
) )
# Call candidate generator. # Call candidate generator.
if self.candidates_doc_mode: if self.candidates_doc_mode:
@ -476,7 +476,7 @@ class EntityLinker(TrainablePipe):
( (
[doc.ents[idx] for idx in next(valid_ent_idx_per_doc)] [doc.ents[idx] for idx in next(valid_ent_idx_per_doc)]
for doc in docs for doc in docs
if len(docs) and len(doc.ents) if len(doc) and len(doc.ents)
), ),
) )
else: else:
@ -487,7 +487,7 @@ class EntityLinker(TrainablePipe):
for idx in next(valid_ent_idx_per_doc) for idx in next(valid_ent_idx_per_doc)
] ]
for doc in docs for doc in docs
if len(docs) and len(doc.ents) if len(doc) and len(doc.ents)
) )
for doc_idx, doc in enumerate(docs): for doc_idx, doc in enumerate(docs):