mirror of
https://github.com/explosion/spaCy.git
synced 2025-03-12 15:25:47 +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 ..tokens.doc cimport Doc, set_children_from_heads
|
||||||
|
|
||||||
from ..gold import Example
|
|
||||||
from ..errors import Errors
|
from ..errors import Errors
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +50,11 @@ def is_nonproj_arc(tokenid, heads):
|
||||||
elif head is None: # unattached tokens cannot be non-projective
|
elif head is None: # unattached tokens cannot be non-projective
|
||||||
return False
|
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 k in range(start, end):
|
||||||
for ancestor in ancestors(k, heads):
|
for ancestor in ancestors(k, heads):
|
||||||
if ancestor is None: # for unattached tokens/subtrees
|
if ancestor is None: # for unattached tokens/subtrees
|
||||||
|
|
Loading…
Reference in New Issue
Block a user