title: Python NLTK Chunking
body: <p>Using NLTK, I would like to write down a tag pattern to handle something like noun phrases with gerunds and/or coordinated noun. After importing essential libraries, I tokenize my candidate text as follows:</p>
  
  <p><code>sentences=nltk.word_tokenize('......')</code></p>
  
  <p>It contains several sentences. 
  Then I tag it by:</p>
  
  <p><code>sentences=nltk.pos_tag(sentences)</code></p>
  
  <p>I also defined my proposed grammar as:</p>
  
  <pre><code>grammar= r"""
  Gerunds: {&lt;DT&gt;?&lt;NN&gt;?&lt;VBG&gt;&lt;NN&gt;}
  Coordinated noun: {&lt;NNP&gt;&lt;CC&gt;&lt;NNP&gt;|&lt;DT&gt;&lt;PRP\$&gt;&lt;NNS&gt;&lt;CC&gt;
  &lt;NNS&gt;|&lt;NN&gt;&lt;NNS&gt; &lt;CC&gt;&lt;NNS&gt;} """
  </code></pre>
  
  <p>Then, I employ:</p>
  
  <pre><code>cp=nltk.RegexpParser(grammar);
  for sent in sentences:
     tree = cp.parse(sent)
     for subtree in tree.subtrees():
       if subtree.label()=='Gerunds': print(subtree)
  print(cp.parse(sentences));
  </code></pre>
  
  <p>It says <code>ValueError: chunk structures must contain tagged tokens or trees</code></p>
  
  <p>How should I tackle the problem guys?</p>