mirror of
https://github.com/explosion/spaCy.git
synced 2025-03-12 07:15:48 +03:00
Update nonproj
This commit is contained in:
parent
7d329cd1ac
commit
87f5348e17
|
@ -7,7 +7,6 @@ from copy import copy
|
|||
|
||||
from ..tokens.doc cimport Doc, set_children_from_heads
|
||||
|
||||
from ..gold import Example
|
||||
from ..errors import Errors
|
||||
|
||||
|
||||
|
@ -50,8 +49,12 @@ def is_nonproj_arc(tokenid, heads):
|
|||
return False
|
||||
elif head is None: # unattached tokens cannot be non-projective
|
||||
return False
|
||||
|
||||
start, end = (head+1, tokenid) if head < tokenid else (tokenid+1, head)
|
||||
|
||||
cdef int start, end
|
||||
if head < tokenid:
|
||||
start, end = (head+1, tokenid)
|
||||
else:
|
||||
start, end = (tokenid+1, head)
|
||||
for k in range(start, end):
|
||||
for ancestor in ancestors(k, heads):
|
||||
if ancestor is None: # for unattached tokens/subtrees
|
||||
|
|
Loading…
Reference in New Issue
Block a user