mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +03:00 
			
		
		
		
	Fix Span.to_array method
This commit is contained in:
		
							parent
							
								
									c606b4a42c
								
							
						
					
					
						commit
						dea229c634
					
				| 
						 | 
					@ -151,10 +151,11 @@ cdef class Span:
 | 
				
			||||||
        # Make an array from the attributes --- otherwise our inner loop is Python
 | 
					        # Make an array from the attributes --- otherwise our inner loop is Python
 | 
				
			||||||
        # dict iteration.
 | 
					        # dict iteration.
 | 
				
			||||||
        cdef np.ndarray[attr_t, ndim=1] attr_ids = numpy.asarray(py_attr_ids, dtype=numpy.uint64)
 | 
					        cdef np.ndarray[attr_t, ndim=1] attr_ids = numpy.asarray(py_attr_ids, dtype=numpy.uint64)
 | 
				
			||||||
        output = numpy.ndarray(shape=(self.length, len(attr_ids)), dtype=numpy.uint64)
 | 
					        cdef int length = self.end - self.start
 | 
				
			||||||
 | 
					        output = numpy.ndarray(shape=(length, len(attr_ids)), dtype=numpy.uint64)
 | 
				
			||||||
        for i in range(self.start, self.end):
 | 
					        for i in range(self.start, self.end):
 | 
				
			||||||
            for j, feature in enumerate(attr_ids):
 | 
					            for j, feature in enumerate(attr_ids):
 | 
				
			||||||
                output[i, j] = get_token_attr(&self.doc.c[i], feature)
 | 
					                output[i-self.start, j] = get_token_attr(&self.doc.c[i], feature)
 | 
				
			||||||
        return output
 | 
					        return output
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef int _recalculate_indices(self) except -1:
 | 
					    cpdef int _recalculate_indices(self) except -1:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user