diff --git a/spacy/tokens/doc.pyx b/spacy/tokens/doc.pyx index daab22434..07f1f3336 100644 --- a/spacy/tokens/doc.pyx +++ b/spacy/tokens/doc.pyx @@ -305,7 +305,7 @@ cdef class Doc: break else: return 1.0 - + if self.vector_norm == 0 or other.vector_norm == 0: return 0.0 return numpy.dot(self.vector, other.vector) / (self.vector_norm * other.vector_norm)