diff --git a/spacy/tokens/doc.pxd b/spacy/tokens/doc.pxd index 307f635ca..6b11476a9 100644 --- a/spacy/tokens/doc.pxd +++ b/spacy/tokens/doc.pxd @@ -33,6 +33,7 @@ cdef class Doc: cdef public object _vector_norm cdef public np.ndarray tensor + cdef public object user_data cdef TokenC* c diff --git a/spacy/tokens/doc.pyx b/spacy/tokens/doc.pyx index 2fd1ba2e8..5642dc624 100644 --- a/spacy/tokens/doc.pyx +++ b/spacy/tokens/doc.pyx @@ -117,6 +117,8 @@ cdef class Doc: self.is_parsed = False self.getters_for_tokens = {} self.getters_for_spans = {} + self.tensor = np.zeros((0,), dtype='float32') + self.user_data = {} self._py_tokens = [] self._vector = None self.noun_chunks_iterator = CHUNKERS.get(self.vocab.lang)