mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 08:12:24 +03:00
Harmonize checks for entity candidate generation and document skipping.
This commit is contained in:
parent
b32f48c878
commit
9c69c3c313
|
@ -476,7 +476,7 @@ class EntityLinker(TrainablePipe):
|
|||
(
|
||||
[doc.ents[idx] for idx in next(valid_ent_idx_per_doc)]
|
||||
for doc in docs
|
||||
if len(doc.ents)
|
||||
if len(docs) and len(doc.ents)
|
||||
),
|
||||
)
|
||||
else:
|
||||
|
@ -487,11 +487,11 @@ class EntityLinker(TrainablePipe):
|
|||
for idx in next(valid_ent_idx_per_doc)
|
||||
]
|
||||
for doc in docs
|
||||
if len(doc.ents)
|
||||
if len(docs) and len(doc.ents)
|
||||
)
|
||||
|
||||
for doc_idx, doc in enumerate(docs):
|
||||
if len(doc) == 0:
|
||||
if len(doc) == 0 or len(doc.ents) == 0:
|
||||
continue
|
||||
sentences = [s for s in doc.sents]
|
||||
doc_ent_cands = list(next(all_ent_cands)) if len(doc.ents) else []
|
||||
|
|
Loading…
Reference in New Issue
Block a user