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)]
|
[doc.ents[idx] for idx in next(valid_ent_idx_per_doc)]
|
||||||
for doc in docs
|
for doc in docs
|
||||||
if len(doc.ents)
|
if len(docs) and len(doc.ents)
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -487,11 +487,11 @@ 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(doc.ents)
|
if len(docs) and len(doc.ents)
|
||||||
)
|
)
|
||||||
|
|
||||||
for doc_idx, doc in enumerate(docs):
|
for doc_idx, doc in enumerate(docs):
|
||||||
if len(doc) == 0:
|
if len(doc) == 0 or len(doc.ents) == 0:
|
||||||
continue
|
continue
|
||||||
sentences = [s for s in doc.sents]
|
sentences = [s for s in doc.sents]
|
||||||
doc_ent_cands = list(next(all_ent_cands)) if len(doc.ents) else []
|
doc_ent_cands = list(next(all_ent_cands)) if len(doc.ents) else []
|
||||||
|
|
Loading…
Reference in New Issue
Block a user