title: How to change the word order of phrasal verbs in a POS-tagged corpus file
body: <p>I have a POS-tagged parallel corpus text file in which I would like to do word reordering, so that the "separable phrasal verb particle" will appear next to the "verb" of the phrasal verb ('make up a plan' instead of 'make a plan up') . This used for preprocessing in a statistical machine translation system. Here are some example lines from the POS-tagged text file:</p>
  
  <ol>
  <li>you_PRP mean_VBP we_PRP should_MD kick_VB them_PRP out_RP ._. </li>
  <li>don_VB &apos;t_NNP take_VB it_PRP off_RP until_IN I_PRP say_VBP so_RB ._.</li>
  <li>please_VB help_VB the_DT man_NN out_RP ._.</li>
  <li>shut_VBZ it_PRP down_RP !_.</li>
  </ol>
  
  <p>I would like to move all the particles (in the examples: out_RP, off_RP, out_RP, down_RP) right next to the closest preceding verb (i.e. the verb that in combination with the particle makes up the phrasal verb). Here's what the lines should looks like after having changed the word order:  </p>
  
  <ol>
  <li>you_PRP mean_VBP we_PRP should_MD kick_VB out_RP them_PRP ._. </li>
  <li>don_VB &apos;t_NNP take_VB off_RP it_PRP until_IN I_PRP say_VBP so_RB ._.</li>
  <li>please_VB help_VB out_RP the_DT man_NN ._.</li>
  <li>shut_VBZ down_RP it_PRP !_.</li>
  </ol>
  
  <p>So far I've tried using python and regular expressions to sort the problem by using re.findall:</p>
  
  <pre><code>import re 
  
  file=open('first100k.txt').read()
  matchline3='\w*_VB.?\s\w*_DT\s\w*_NN\s\w*_RP'
  wordorder1=re.findall(matchline3,file)
  print wordorder1
  </code></pre>
  
  <p>This will find all the phrasal verbs in word order 1(see below), but that's as far as I've got since I can't figure out how to move the particle next to the verb. Any ideas how to solve this problem properly (not necessarily by using python and regex)? I would like to be able to search for all phrasal verbs and move the particles in the following word orders:</p>
  
  <p>(The used tags are taken from the Penn Treebank tagset (<a href="http://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html" rel="nofollow">http://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html</a> )(the x denotes an optional character in order to include all verb forms, and * denotes a wildcard word))</p>
  
  <ol>
  <li>*_VBx+*_DT+*_NN+*_RP</li>
  <li>*_VBx+*_DT+*_NNS+*_RP</li>
  <li>*_<em>VBx+*</em>_DT+*_.JJ+*_NN+*_RP</li>
  <li><p>*_<em>VBx+*</em>_DT+*_.JJ+*_NNS+*_RP</p></li>
  <li><p>*_VBx+*_PRP$+*_NN+*_RP</p></li>
  <li>*_VBx+*_PRP$+*_NNS+*_RP</li>
  <li>*_<em>VBx+*</em>_PRP$+*_.JJ+*_NN+*_RP</li>
  <li><p>*_<em>VBx+*</em>_PRP$+*_.JJ+*_NNS+*_RP</p></li>
  <li><p>*_VBx+*_NNP+*_RP</p></li>
  <li><p>*_VBx+*_JJ+*_NNP+*_RP</p></li>
  <li><p>*_VBx+*_NNPS+*_RP</p></li>
  <li><p>*_VBx+*_PRP+*_RP </p></li>
  </ol>
  
  <p>In advance, thanks for your help!</p>