title: Extract same elements chunk from list after instance of a particular element
body: <p>I'm trying to extract the sequential 'NN' elements (including 'NNP') from a list and append to a new list given 'IN' or 'TO' are encountered before 'NN'. How can I do it?</p>
  
  <p>I tried the following code. But unable to capture the  other similar instances.</p>
  
  <pre><code>    new = ['JJ',
   'NN',
   'IN',
   'NNP',
   'NN',
   'MD',
   'VB',
   'VBN',
   'IN',
   'NN',
   'TO',
   'VB',
   'NN',
   'CC',
   'NN',
   'TO',
   'NNP',
   'NN',
   'NN',
   '.']
  
  lst = []
  for i,j in enumerate(new):
      lst1 = []
      if j == 'IN':
          for i in new[i+1:]:
              if 'NN' in i:
                  lst1.append(i)
                  lst.append(lst1)
                  break
  
  lst = [['NNP'], ['NN']]
  </code></pre>
  
  <p>But I want to improve the code to give the below output:</p>
  
  <pre><code>[['NNP', 'NN'], ['NN'], ['NNP', 'NN', 'NN']
  </code></pre>
  
  <p>Each output chunk has either 'IN' or 'TO' occurred before them.</p>
  
  <p>Actually, the above list (new) is underlying parts of speech for this list :          </p>
  
  <pre><code>[['Additional',
    'condition',
    'of',
    'DeNOx',
    'activation',
    'shall',
    'be',
    'introduced',
    'in',
    'order',
    'to',
    'provide',
    'flexibility',
    'and',
    'robustness',
    'to',
    'NSC',
    'regeneration',
    'management',
    '.'],
   ['JJ',
    'NN',
    'IN',
    'NNP',
    'NN',
    'MD',
    'VB',
    'VBN',
    'IN',
    'NN',
    'TO',
    'VB',
    'NN',
    'CC',
    'NN',
    'TO',
    'NNP',
    'NN',
    'NN',
    '.']].
  </code></pre>
  
  <p>How can I map the results back to this list so that I will get </p>
  
  <pre><code>[['DeNOx', 'activation'], ['order'], ['NSC', 'regeneration', 'management']]
  </code></pre>