Format. Update assert in ent.sents handling.

This commit is contained in:
Raphael Mitsch 2023-03-14 13:18:11 +01:00
parent 9b6f47f1ac
commit fc0f954d9b

View File

@ -476,8 +476,11 @@ class EntityLinker(TrainablePipe):
for j, ent in enumerate(ent_batch):
assert hasattr(ent, "sents")
sents = list(ent.sents)
sent_indices = (sentences.index(sents[0]), sentences.index(sents[-1]))
assert all([si >= 0 for si in sent_indices])
sent_indices = (
sentences.index(sents[0]),
sentences.index(sents[-1]),
)
assert sent_indices[-1] >= sent_indices[0] >= 0
if self.incl_context:
# get n_neighbour sentences, clipped to the length of the document