diff --git a/spacy/syntax/parser.pyx b/spacy/syntax/parser.pyx index 6fc17c282..f75afbdf7 100644 --- a/spacy/syntax/parser.pyx +++ b/spacy/syntax/parser.pyx @@ -304,14 +304,13 @@ cdef class StepwiseState: class ParserStateError(ValueError): - def __repr__(self): - raise ValueError( - "Error analysing doc -- no valid actions available. This should " - "never happen, so please report the error on the issue tracker. " - "Here's the thread to do so --- reopen it if it's closed:\n" - "https://github.com/spacy-io/spaCy/issues/429\n" - "Please include the text that the parser failed on, which is:\n" - "%s" % repr(self.args[0].text)) + def __init__(self, doc): + self.message = ("Error analysing doc -- no valid actions available. This should " + "never happen, so please report the error on the issue tracker. " + "Here's the thread to do so --- reopen it if it's closed:\n" + "https://github.com/spacy-io/spaCy/issues/429\n" + "Please include the text that the parser failed on, which is:\n" + "%s" % repr(doc.text)) cdef int _arg_max_clas(const weight_t* scores, int move, const Transition* actions,