* Add better debug message for illegal move

This commit is contained in:
Matthew Honnibal 2015-11-07 05:34:37 +11:00
parent 2733816b7b
commit 19136b0e7d

View File

@ -105,9 +105,12 @@ cdef class Parser:
self.moves.set_valid(eg.is_valid, stcls) self.moves.set_valid(eg.is_valid, stcls)
self.model.set_prediction(&eg) self.model.set_prediction(&eg)
assert eg.is_valid[eg.guess]
action = self.moves.c[eg.guess] action = self.moves.c[eg.guess]
if not eg.is_valid[eg.guess]:
raise ValueError(
"Illegal action: %s" % self.moves.move_name(action.move, action.label)
)
action.do(stcls, action.label) action.do(stcls, action.label)
self.moves.finalize_state(stcls) self.moves.finalize_state(stcls)
tokens.set_parse(stcls._sent) tokens.set_parse(stcls._sent)