mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-22 10:02:01 +03:00
Drop valid_ent_idx_per_doc.
This commit is contained in:
parent
40e3acacda
commit
ee5d7f4a33
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user