mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-10-31 07:57:35 +03:00 
			
		
		
		
	Use relative indices for mentions
Was using batch absolute indices to manage mentions, but extract_spans expects doc-relative ones.
This commit is contained in:
		
							parent
							
								
									3684f7fdfd
								
							
						
					
					
						commit
						4a9dc00d86
					
				|  | @ -153,7 +153,6 @@ def span_embeddings_forward( | |||
|     get_mentions = model.attrs["get_mentions"] | ||||
|     max_span_width = model.attrs["max_span_width"] | ||||
|     mentions = ops.alloc2i(0, 2) | ||||
|     total_length = 0 | ||||
|     docmenlens = []  # number of mentions per doc | ||||
| 
 | ||||
|     for doc in docs: | ||||
|  | @ -161,8 +160,7 @@ def span_embeddings_forward( | |||
|         docmenlens.append(len(starts)) | ||||
|         cments = ops.asarray2i([starts, ends]).transpose() | ||||
| 
 | ||||
|         mentions = xp.concatenate((mentions, cments + total_length)) | ||||
|         total_length += len(doc) | ||||
|         mentions = xp.concatenate( (mentions, cments) ) | ||||
| 
 | ||||
|     # TODO support attention here | ||||
|     tokvecs = xp.concatenate(tokvecs) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user