From 3d22fcaf0b3c7e4114153b5b3e1d8eb078fa8e44 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 26 May 2017 14:02:59 -0500 Subject: [PATCH] Return None from parser if there are no annotations --- spacy/syntax/nn_parser.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spacy/syntax/nn_parser.pyx b/spacy/syntax/nn_parser.pyx index 35966d536..b7aca26b8 100644 --- a/spacy/syntax/nn_parser.pyx +++ b/spacy/syntax/nn_parser.pyx @@ -432,6 +432,8 @@ cdef class Parser: 0.0) todo = [(s, g) for (s, g) in zip(states, golds) if not s.is_final() and g is not None] + if not todo: + return None backprops = [] d_tokvecs = state2vec.ops.allocate(tokvecs.shape)