From 675f4483135e00e54d88f3aea11ccd5afa5c3952 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 4 Jun 2017 14:25:30 -0500 Subject: [PATCH] Fix vector linkage on Doc --- spacy/tokens/doc.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/tokens/doc.pyx b/spacy/tokens/doc.pyx index b2706ea6f..daf36bb85 100644 --- a/spacy/tokens/doc.pyx +++ b/spacy/tokens/doc.pyx @@ -255,7 +255,7 @@ cdef class Doc: return self.user_hooks['has_vector'](self) elif any(token.has_vector for token in self): return True - elif self.tensor: + elif self.tensor is not None: return True else: return False @@ -275,7 +275,7 @@ cdef class Doc: elif self.has_vector and len(self): self._vector = sum(t.vector for t in self) / len(self) return self._vector - elif self.tensor: + elif self.tensor is not None: self._vector = self.tensor.mean(axis=0) return self._vector else: