diff --git a/spacy/pipeline/spancat.py b/spacy/pipeline/spancat.py index fc6ad5ee1..5c1f77cf6 100644 --- a/spacy/pipeline/spancat.py +++ b/spacy/pipeline/spancat.py @@ -272,7 +272,7 @@ class SpanCategorizer(TrainablePipe): DOCS: https://spacy.io/api/spancategorizer#predict """ indices = self.suggester(docs, ops=self.model.ops) - if sum(indices.lengths) == 0: + if indices.lengths.sum() == 0: scores = self.model.ops.alloc2f(0, 0) else: scores = self.model.predict((docs, indices)) # type: ignore