clips / clips/pattern

How to get IOB chunk tag in parsetree?

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

Nobody has claimed this yet.

Dominant language
Python
Stars
8.9k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

In the output of pattern.en.parsetree , the results all contains the IOB format tag.
When using chunks to get them out, the IOB format is lost, no matter in repr(s) or pprint(s). But when print out the sentence, the IOB format tag is there.

So how can I extract IOB format tags?

Original sentence:
This means the nucleus is either too big to hold itself together or has too many protons, electrons or neutrons.

repr(s) result
"[Sentence('This/DT/O/O/this means/VBZ/B-VP/O/mean the/DT/B-NP/O/the nucleus/NN/I-NP/O/nucleus is/VBZ/B-VP/O/be either/RB/B-ADJP/O/either too/RB/I-ADJP/O/too big/JJ/I-ADJP/O/big to/TO/B-VP/O/to hold/VB/I-VP/O/hold itself/PRP/B-NP/O/itself together/RB/B-ADVP/O/together or/CC/O/O/or has/VBZ/B-VP/O/have too/RB/B-NP/O/too many/JJ/I-NP/O/many protons/NNS/I-NP/O/proton ,/,/O/O/, electrons/NNS/B-NP/O/electron or/CC/I-NP/O/or neutrons/NNS/I-NP/O/neutron ././O/O/.')]"

pprint(s)

` WORD TAG CHUNK ROLE ID PNP LEMMA

      This   DT     -        -      -      -      this
     means   VBZ    VP       -      -      -      mean
       the   DT     NP       -      -      -      the
   nucleus   NN     NP ^     -      -      -      nucleus
        is   VBZ    VP       -      -      -      be
    either   RB     ADJP     -      -      -      either
       too   RB     ADJP ^   -      -      -      too
       big   JJ     ADJP ^   -      -      -      big
        to   TO     VP       -      -      -      to
      hold   VB     VP ^     -      -      -      hold
    itself   PRP    NP       -      -      -      itself
  together   RB     ADVP     -      -      -      together
        or   CC     -        -      -      -      or
       has   VBZ    VP       -      -      -      have
       too   RB     NP       -      -      -      too
      many   JJ     NP ^     -      -      -      many
   protons   NNS    NP ^     -      -      -      proton
         ,   ,      -        -      -      -      ,
 electrons   NNS    NP       -      -      -      electron
        or   CC     NP ^     -      -      -      or
  neutrons   NNS    NP ^     -      -      -      neutron
         .   .      -        -      -      -      .`

Also, what is ^ is the pprint result? And how are they displayed in this way?

Thank you very much.

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.

Research direction

Start with the pattern.en.parsetree entry point and compare how chunk objects are rendered by repr, pprint, and print. Document how to extract IOB tags and explain what the ^ marker means in the pprint output; the issue is complete when both questions have a clear, reproducible answer.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.