mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	Add merge_phrase callback in matcher.pyx
This commit is contained in:
		
							parent
							
								
									e854f28304
								
							
						
					
					
						commit
						725249c59a
					
				| 
						 | 
					@ -161,6 +161,13 @@ def _convert_strings(token_specs, string_store):
 | 
				
			||||||
    return tokens
 | 
					    return tokens
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def merge_phrase(matcher, doc, i, matches):
 | 
				
			||||||
 | 
					    '''Callback to merge a phrase on match'''
 | 
				
			||||||
 | 
					    ent_id, label, start, end = matches[i]
 | 
				
			||||||
 | 
					    span = doc[start : end] 
 | 
				
			||||||
 | 
					    span.merge(ent_type=label, ent_id=ent_id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class Matcher:
 | 
					cdef class Matcher:
 | 
				
			||||||
    '''Match sequences of tokens, based on pattern rules.'''
 | 
					    '''Match sequences of tokens, based on pattern rules.'''
 | 
				
			||||||
    cdef Pool mem
 | 
					    cdef Pool mem
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user