From 99649d114d4bce264c9568a864680b0ba5b40963 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 8 May 2018 00:27:26 +0200 Subject: [PATCH] Fix parser --- spacy/syntax/nn_parser.pyx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spacy/syntax/nn_parser.pyx b/spacy/syntax/nn_parser.pyx index e3d83d4c1..d7f64d937 100644 --- a/spacy/syntax/nn_parser.pyx +++ b/spacy/syntax/nn_parser.pyx @@ -218,9 +218,10 @@ cdef class Parser: if beam_width == 1: batch = self.moves.init_batch(docs) weights = get_c_weights(model) - sizes = get_c_sizes(model, states.size()) for state in batch: - states.push_back(state.c) + if not state.is_final(): + states.push_back(state.c) + sizes = get_c_sizes(model, states.size()) with nogil: self._parseC(&states[0], weights, sizes)