Add merge_phrase callback in matcher.pyx

This commit is contained in:
Matthew Honnibal 2017-03-31 13:58:59 +02:00
parent e854f28304
commit 725249c59a

View File

@ -161,6 +161,13 @@ def _convert_strings(token_specs, string_store):
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:
'''Match sequences of tokens, based on pattern rules.'''
cdef Pool mem