mirror of https://github.com/explosion/spaCy.git
Fix vector linkage on Doc
This commit is contained in:
parent
f4662e9218
commit
675f448313
|
@ -255,7 +255,7 @@ cdef class Doc:
|
||||||
return self.user_hooks['has_vector'](self)
|
return self.user_hooks['has_vector'](self)
|
||||||
elif any(token.has_vector for token in self):
|
elif any(token.has_vector for token in self):
|
||||||
return True
|
return True
|
||||||
elif self.tensor:
|
elif self.tensor is not None:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
@ -275,7 +275,7 @@ cdef class Doc:
|
||||||
elif self.has_vector and len(self):
|
elif self.has_vector and len(self):
|
||||||
self._vector = sum(t.vector for t in self) / len(self)
|
self._vector = sum(t.vector for t in self) / len(self)
|
||||||
return self._vector
|
return self._vector
|
||||||
elif self.tensor:
|
elif self.tensor is not None:
|
||||||
self._vector = self.tensor.mean(axis=0)
|
self._vector = self.tensor.mean(axis=0)
|
||||||
return self._vector
|
return self._vector
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue