title: How to use nltk regex pattern to extract a specific phrase chunk?
body: <p>I have written the following regex to tag certain phrases pattern</p>
  
  <pre><code>pattern = """
          P2: {&lt;JJ&gt;+ &lt;RB&gt;? &lt;JJ&gt;* &lt;NN&gt;+ &lt;VB&gt;* &lt;JJ&gt;*}
          P1: {&lt;JJ&gt;? &lt;NN&gt;+ &lt;CC&gt;? &lt;NN&gt;* &lt;VB&gt;? &lt;RB&gt;* &lt;JJ&gt;+}
          P3: {&lt;NP1&gt;&lt;IN&gt;&lt;NP2&gt;}
          P4: {&lt;NP2&gt;&lt;IN&gt;&lt;NP1&gt;}
  
      """
  </code></pre>
  
  <p>This pattern would correctly tag a phrase such as:</p>
  
  <pre><code>a = 'The pizza was good but pasta was bad'
  </code></pre>
  
  <p>and give the desired output with 2 phrases: </p>
  
  <ol>
  <li>pizza was good</li>
  <li>pasta was bad</li>
  </ol>
  
  <p>However, if my sentence is something like:</p>
  
  <pre><code>a = 'The pizza was awesome and brilliant'
  </code></pre>
  
  <p>matches only the phrase:</p>
  
  <pre><code>'pizza was awesome' 
  </code></pre>
  
  <p>instead of the desired:</p>
  
  <pre><code>'pizza was awesome and brilliant'
  </code></pre>
  
  <p><strong>How do I incorporate the regex pattern for my second example as well?</strong></p>