Skip to content

Commit

Permalink
Raise errors when no actions are available, re Issue #429
Browse files Browse the repository at this point in the history
  • Loading branch information
honnibal committed Sep 27, 2016
1 parent fc4a7ad commit 430473b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion spacy/syntax/parser.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ cdef class Parser:
cdef int nr_class = self.moves.n_moves
cdef int nr_feat = self.model.nr_feat
with nogil:
self.parseC(tokens.c, tokens.length, nr_feat, nr_class)
status = self.parseC(tokens.c, tokens.length, nr_feat, nr_class)
# Check for KeyboardInterrupt etc. Untested
PyErr_CheckSignals()
if status != 0:
raise ValueError("Error parsing doc: %s" % tokens.text)
self.moves.finalize_doc(tokens)

def pipe(self, stream, int batch_size=1000, int n_threads=2):
Expand Down

0 comments on commit 430473b

Please sign in to comment.