pattern icon indicating copy to clipboard operation
pattern copied to clipboard

Match : does not match a NP-group ?

Open vsraptor opened this issue 4 years ago • 0 comments

For some reason MATCHING cant find the third {NP} ? As you can see there is 3 NP chunks, so it should work !! Any idea ?


In [120]: s1 = Sentence(parse('The students consider the course a challenge'))

In [121]: s1.string
Out[121]: u'The students consider the course a challenge'

In [122]: m = match('{NP} {VB*} {NP} {NP}', s1)

In [123]: m.constituents()
Out[123]: [Chunk('The students/NP'), Chunk('consider/VP'), Chunk('the course/NP')]

In [125]: s1.chunks
Out[125]: 
 [Chunk('The students/NP'),
  Chunk('consider/VP'),
 Chunk('the course/NP'),
 Chunk('a challenge/NP')]

 In [126]: pprint(s1)

      WORD   TAG    CHUNK   ROLE   ID     PNP    LEMMA   
                                                         
       The   DT     NP      -      -      -      -       
  students   NNS    NP ^    -      -      -      -       
  consider   VB     VP      -      -      -      -       
       the   DT     NP      -      -      -      -       
    course   NN     NP ^    -      -      -      -       
         a   DT     NP      -      -      -      -       
 challenge   NN     NP ^    -      -      -      -       

vsraptor avatar Aug 24 '19 17:08 vsraptor