Remove mypy ignore and typecast labels to list

This commit is contained in:
Lj Miranda 2022-11-29 11:14:43 +08:00
parent 14ae4a52c0
commit 0b32a949f1

View File

@ -191,7 +191,7 @@ class Exclusive_SpanCategorizer(SpanCategorizer):
DOCS: https://spacy.io/api/spancatcategorizer#set_annotations DOCS: https://spacy.io/api/spancatcategorizer#set_annotations
""" """
allow_overlap = cast(bool, self.cfg["allow_overlap"]) allow_overlap = cast(bool, self.cfg["allow_overlap"])
labels = self.labels labels = list(self.labels)
indices, scores = indices_scores indices, scores = indices_scores
offset = 0 offset = 0
for i, doc in enumerate(docs): for i, doc in enumerate(docs):
@ -200,7 +200,7 @@ class Exclusive_SpanCategorizer(SpanCategorizer):
doc, doc,
indices_i, indices_i,
scores[offset : offset + indices.lengths[i]], scores[offset : offset + indices.lengths[i]],
labels, # type: ignore[arg-type] labels,
allow_overlap, allow_overlap,
) )
offset += indices.lengths[i] offset += indices.lengths[i]