From fbb7f3f15cd78ce551ee59572b34872df20103a9 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 17 Oct 2016 11:43:22 +0200 Subject: [PATCH] Add user_data attribute to Doc object. --- spacy/tokens/doc.pxd | 1 + spacy/tokens/doc.pyx | 2 ++ 2 files changed, 3 insertions(+) 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)