def test_issue242(en_tokenizer):
 text = u'There are different food safety standards in different countries.'
 patterns = [[{LOWER: u'food'}, {LOWER: u'safety'}], [{LOWER: u'safety'}, {LOWER: u'standards'}]]
 doc = en_tokenizer(text)
 matcher = Matcher(doc.vocab)
 matcher.add(u'FOOD', u'FOOD', {}, patterns)
 matches = [(ent_type, start, end) for (ent_id, ent_type, start, end) in matcher(doc)]
 doc.ents += tuple(matches)
 (match1, match2) = matches
 assert (match1[1] == 3)
 assert (match1[2] == 5)
 assert (match2[1] == 4)
 assert (match2[2] == 6)

def test_issue242 ( en_tokenizer ) : text = u'There are different food safety standards in different countries.' patterns = [ [ { LOWER : u'food' } , { LOWER : u'safety' } ] , [ { LOWER : u'safety' } , { LOWER : u'standards' } ] ] doc = en_tokenizer ( text ) matcher = Matcher ( doc . vocab ) matcher . add ( u'FOOD' , u'FOOD' , { } , patterns ) matches = [ ( ent_type , start , end ) for ( ent_id , ent_type , start , end ) in matcher ( doc ) ] doc . ents += tuple ( matches ) ( match1 , match2 ) = matches assert ( match1 [ 1 ] == 3 ) assert ( match1 [ 2 ] == 5 ) assert ( match2 [ 1 ] == 4 ) assert ( match2 [ 2 ] == 6 )
test overlapping multi-word phrases .