mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-11 00:50:33 +03:00
Clean up debugging
This commit is contained in:
parent
b250f6b62f
commit
e92be79ffc
|
@ -61,7 +61,7 @@ cdef class TransitionSystem:
|
|||
offset += len(doc)
|
||||
return states
|
||||
|
||||
def get_oracle_sequence(self, Example example):
|
||||
def get_oracle_sequence(self, Example example, _debug=False):
|
||||
cdef Pool mem = Pool()
|
||||
# n_moves should not be zero at this point, but make sure to avoid zero-length mem alloc
|
||||
assert self.n_moves > 0
|
||||
|
@ -70,6 +70,8 @@ cdef class TransitionSystem:
|
|||
|
||||
cdef StateClass state
|
||||
states, golds, n_steps = self.init_gold_batch([example])
|
||||
if not states:
|
||||
return []
|
||||
state = states[0]
|
||||
gold = golds[0]
|
||||
history = []
|
||||
|
@ -82,6 +84,7 @@ cdef class TransitionSystem:
|
|||
history.append(i)
|
||||
s0 = state.S(0)
|
||||
b0 = state.B(0)
|
||||
if _debug:
|
||||
debug_log.append(" ".join((
|
||||
self.get_class_name(i),
|
||||
"S0=", (example.x[s0].text if s0 >= 0 else "__"),
|
||||
|
@ -91,6 +94,7 @@ cdef class TransitionSystem:
|
|||
action.do(state.c, action.label)
|
||||
break
|
||||
else:
|
||||
if _debug:
|
||||
print("Actions")
|
||||
for i in range(self.n_moves):
|
||||
print(self.get_class_name(i))
|
||||
|
|
Loading…
Reference in New Issue
Block a user