Match : does not match a NP-group ?

Open
#287 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start by reproducing the example with parse(), Sentence, and match('{NP} {VB*} {NP} {NP}', s1), then trace the matching entry point and how constituents are returned. Done means the match includes all three NP chunks, including “a challenge,” with a regression check for this example.

Written by the indexing model from the issue text.

Description

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 ^    -      -      -      -       
Dominant language
Python
Stars
8.9k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from clips/pattern

All issues in clips/pattern

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.