From c55b8fa7c555b82e69b52a6ebad327027b4a6327 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 23 May 2017 05:57:52 -0500 Subject: [PATCH] Fix bugs in parse_batch --- spacy/syntax/nn_parser.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/syntax/nn_parser.pyx b/spacy/syntax/nn_parser.pyx index e24143839..8a418aded 100644 --- a/spacy/syntax/nn_parser.pyx +++ b/spacy/syntax/nn_parser.pyx @@ -337,7 +337,7 @@ cdef class Parser: feat_weights = state2vec.get_feat_weights() cdef int i cdef np.ndarray token_ids = numpy.zeros((nr_state, nr_feat), dtype='i') - cdef np.ndarray is_valid = numpy.zeros((nr_state, nr_feat), dtype='i') + cdef np.ndarray is_valid = numpy.zeros((nr_state, nr_class), dtype='i') cdef np.ndarray scores c_token_ids = token_ids.data c_is_valid = is_valid.data @@ -347,7 +347,7 @@ cdef class Parser: st.set_context_tokens(&c_token_ids[i*nr_feat], nr_feat) self.moves.set_valid(&c_is_valid[i*nr_class], st) vectors = state2vec.begin_update(token_ids[:next_step.size()]) - scores = vec2scores(vectors) + scores = vec2scores(vectors)[0] c_scores = scores.data for i in range(next_step.size()): st = next_step[i]