From 4632c597e7d1d175077a7bf147cf9ad201ef04e5 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 1 Aug 2019 17:29:01 +0200 Subject: [PATCH] Fix Pipe base class --- spacy/pipeline/pipes.pyx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spacy/pipeline/pipes.pyx b/spacy/pipeline/pipes.pyx index ba1fca24e..375a0884b 100644 --- a/spacy/pipeline/pipes.pyx +++ b/spacy/pipeline/pipes.pyx @@ -66,8 +66,12 @@ class Pipe(object): and `set_annotations()` methods. """ self.require_model() - scores, tensors = self.predict([doc]) - self.set_annotations([doc], scores, tensors=tensors) + predictions = self.predict([doc]) + if isinstance(predictions, tuple) and len(tuple) == 2: + scores, tensors = predictions + self.set_annotations([doc], scores, tensor=tensors) + else: + self.set_annotations([doc], predictions) return doc def require_model(self):