mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
* Add better debug message for illegal move
This commit is contained in:
parent
2733816b7b
commit
19136b0e7d
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user