From b42c123e5de4cbfb32c5dcd89d58a92287266664 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 25 Sep 2018 11:08:58 +0200 Subject: [PATCH] Fix regression introduced by 1759abf1e --- spacy/tokens/doc.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spacy/tokens/doc.pyx b/spacy/tokens/doc.pyx index bfebe9304..16d6557c9 100644 --- a/spacy/tokens/doc.pyx +++ b/spacy/tokens/doc.pyx @@ -994,12 +994,12 @@ cdef int set_children_from_heads(TokenC* tokens, int length) except -1: tokens[i].l_edge = i tokens[i].r_edge = i # Twice, for non-projectivity - for _ in range(2): + for loop_count in range(2): # Set left edges for i in range(length): child = &tokens[i] head = &tokens[i + child.head] - if child < head: + if child < head and loop_count == 0: head.l_kids += 1 if child.l_edge < head.l_edge: head.l_edge = child.l_edge @@ -1009,7 +1009,7 @@ cdef int set_children_from_heads(TokenC* tokens, int length) except -1: for i in range(length-1, -1, -1): child = &tokens[i] head = &tokens[i + child.head] - if child > head: + if child > head and loop_count == 0: head.r_kids += 1 if child.r_edge > head.r_edge: head.r_edge = child.r_edge