@pytest.mark.parametrize(u'pattern', [pattern1, pattern2])
def test_issue118(doc, pattern):
 ORG = doc.vocab.strings[u'ORG']
 matcher = Matcher(doc.vocab, {u'BostonCeltics': (u'ORG', {}, pattern)})
 assert (len(list(doc.ents)) == 0)
 matches = [(ent_type, start, end) for (ent_id, ent_type, start, end) in matcher(doc)]
 assert (matches == [(ORG, 9, 11), (ORG, 10, 11)])
 doc.ents = matches[:1]
 ents = list(doc.ents)
 assert (len(ents) == 1)
 assert (ents[0].label == ORG)
 assert (ents[0].start == 9)
 assert (ents[0].end == 11)

@ pytest . mark . parametrize ( u'pattern' , [ pattern1 , pattern2 ] ) def test_issue118 ( doc , pattern ) : ORG = doc . vocab . strings [ u'ORG' ] matcher = Matcher ( doc . vocab , { u'BostonCeltics' : ( u'ORG' , { } , pattern ) } ) assert ( len ( list ( doc . ents ) ) == 0 ) matches = [ ( ent_type , start , end ) for ( ent_id , ent_type , start , end ) in matcher ( doc ) ] assert ( matches == [ ( ORG , 9 , 11 ) , ( ORG , 10 , 11 ) ] ) doc . ents = matches [ : 1 ] ents = list ( doc . ents ) assert ( len ( ents ) == 1 ) assert ( ents [ 0 ] . label == ORG ) assert ( ents [ 0 ] . start == 9 ) assert ( ents [ 0 ] . end == 11 )
test a bug that arose from having overlapping matches .