mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	Set l_edge and r_edge correctly for non-projective parses. Fixes #1799
This commit is contained in:
		
							parent
							
								
									964aa1b384
								
							
						
					
					
						commit
						56164ab688
					
				| 
						 | 
				
			
			@ -1035,18 +1035,19 @@ cdef int set_children_from_heads(TokenC* tokens, int length) except -1:
 | 
			
		|||
        child = &tokens[i]
 | 
			
		||||
        head = &tokens[i + child.head]
 | 
			
		||||
        if child < head:
 | 
			
		||||
            head.l_kids += 1
 | 
			
		||||
        if child.l_edge < head.l_edge:
 | 
			
		||||
            head.l_edge = child.l_edge
 | 
			
		||||
            head.l_kids += 1
 | 
			
		||||
 | 
			
		||||
    # Set right edges --- same as above, but iterate in reverse
 | 
			
		||||
    for i in range(length-1, -1, -1):
 | 
			
		||||
        child = &tokens[i]
 | 
			
		||||
        head = &tokens[i + child.head]
 | 
			
		||||
        if child > head:
 | 
			
		||||
            head.r_kids += 1
 | 
			
		||||
        if child.r_edge > head.r_edge:
 | 
			
		||||
            head.r_edge = child.r_edge
 | 
			
		||||
            head.r_kids += 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # Set sentence starts
 | 
			
		||||
    for i in range(length):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user