title: Relation extraction via chunking using NLTK
body: <p>I am trying to figure out how to use NLTK's cascading chunker as per <a href="http://www.nltk.org/book/ch07.html" rel="nofollow">Chapter 7 of the NLTK book</a>. Unfortunately, I'm running into a few issues when performing non-trivial chunking measures.</p>
  
  <p>Let's start with this phrase:</p>
  
  <p><code>"adventure movies between 2000 and 2015 featuring performances by daniel craig"</code></p>
  
  <p>I am able to find all the relevant NPs when I use the following grammar:</p>
  
  <p><code>grammar = "NP: {&lt;DT&gt;?&lt;JJ&gt;*&lt;NN.*&gt;+}"</code></p>
  
  <p>However, I am not sure how to build nested structures with NLTK. The book gives the following format, but there are clearly a few things missing (e.g. How does one actually specify multiple rules?):</p>
  
  <pre><code>grammar = r"""
    NP: {&lt;DT|JJ|NN.*&gt;+}          # Chunk sequences of DT, JJ, NN
    PP: {&lt;IN&gt;&lt;NP&gt;}               # Chunk prepositions followed by NP
    VP: {&lt;VB.*&gt;&lt;NP|PP|CLAUSE&gt;+$} # Chunk verbs and their arguments
    CLAUSE: {&lt;NP&gt;&lt;VP&gt;}           # Chunk NP, VP
    """
  </code></pre>
  
  <p>In my case, I'd like to do something like the following:</p>
  
  <pre><code>grammar = r"""
            MEDIA: {&lt;DT&gt;?&lt;JJ&gt;*&lt;NN.*&gt;+}
            RELATION: {&lt;V.*&gt;}{&lt;DT&gt;?&lt;JJ&gt;*&lt;NN.*&gt;+}
            ENTITY: {&lt;NN.*&gt;}
            """
  </code></pre>
  
  <p>Assuming that I'd like to use a cascaded chunker for my task, what syntax would I need to use? Additionally, is it possible for me to specify specific words (e.g. "directed" or "acted") when using a chunker?</p>