mirror of
https://github.com/explosion/spaCy.git
synced 2025-10-02 18:06:46 +03:00
Add debug to nonproj
This commit is contained in:
parent
4fa967ea84
commit
d123e1ec8f
|
@ -165,7 +165,14 @@ def _find_new_head(token, headlabel):
|
||||||
# returns the id of the first descendant with the given label
|
# returns the id of the first descendant with the given label
|
||||||
# if there is none, return the current head (no change)
|
# if there is none, return the current head (no change)
|
||||||
queue = [token.head]
|
queue = [token.head]
|
||||||
|
n_iter = 0
|
||||||
while queue:
|
while queue:
|
||||||
|
n_iter += 1
|
||||||
|
if n_iter >= len(token.doc):
|
||||||
|
print("Infinite loop")
|
||||||
|
print([(w.i, w.text, w.head.i, w.dep_) for w in token.doc])
|
||||||
|
with open("/tmp/doc.bytes", "wb") as file_:
|
||||||
|
file_.write(token.doc.to_bytes())
|
||||||
next_queue = []
|
next_queue = []
|
||||||
for qtoken in queue:
|
for qtoken in queue:
|
||||||
for child in qtoken.children:
|
for child in qtoken.children:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user