From 5414e2f14b7c0dbcbcec08b1d7a101c5521491e7 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 28 Oct 2017 16:45:54 +0000 Subject: [PATCH] Use missing features in parser --- spacy/syntax/nn_parser.pyx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spacy/syntax/nn_parser.pyx b/spacy/syntax/nn_parser.pyx index 1aa4443d0..558e88b3e 100644 --- a/spacy/syntax/nn_parser.pyx +++ b/spacy/syntax/nn_parser.pyx @@ -157,12 +157,14 @@ cdef void sum_state_features(float* output, const float* cached, const int* token_ids, int B, int F, int O) nogil: cdef int idx, b, f, i cdef const float* feature + padding = cached - (F * O) for b in range(B): for f in range(F): if token_ids[f] < 0: - continue - idx = token_ids[f] * F * O + f*O - feature = &cached[idx] + feature = &padding[f*O] + else: + idx = token_ids[f] * F * O + f*O + feature = &cached[idx] for i in range(O): output[i] += feature[i] output += O