spancat type fixes

This commit is contained in:
Daniël de Kok 2023-06-12 16:43:05 +02:00
parent d82e167aea
commit 4990cfefb4

View File

@ -537,10 +537,11 @@ class SpanCategorizer(TrainablePipe):
DOCS: https://spacy.io/api/spancategorizer#set_annotations
"""
indices = activations["indices"]
scores = activations["scores"]
assert isinstance(indices, Ragged)
scores = cast(Floats2d, activations["scores"])
offset = 0
for i, doc in enumerate(docs):
indices_i = indices[i].dataXd
indices_i = cast(Ints2d, indices[i].dataXd)
if self.save_activations:
doc.activations[self.name] = {}
doc.activations[self.name]["indices"] = indices_i