title: matching results in a list of lists
body: <p>I have a list with the following structure;</p>
  
  <pre><code>[('0','927','928'),('2','693','694'),('2','742','743'),('2','776','777'),('2','804','805'),
  ('2','987','988'),('2','997','998'),('2','1019','1020'),
  ('2','1038','1039'),('2','1047','1048'),('2','1083','1084'),('2','659','660'),
  ('2','677','678'),('2','743','744'),('2','777','778'),('2','805','806'),('2','830','831')
  </code></pre>
  
  <p>the 1st number is an id, the second a position of a word and the third number is the position of a second word. What I need to do and am struggling with is finding sets of words next to each other.</p>
  
  <p>These results are given for searches of 3 words, so there is the positions of word 1 with word 2 and positions of word 2 with word 3. For example ;</p>
  
  <p>I run the phrase query <code>"women in science"</code> I then get the values given in the list above, so <code>('2','776','777')</code> is the results for <code>'women in'</code> and <code>('2','777','778')</code> is the results for <code>'in science'</code>.</p>
  
  <p>I need to find a way to match these results up, so for every document it groups the words together depending on amounts of word in the query. (so if there is 4 words in the query there will be 3 results that need to be matched together). </p>
  
  <p>Is this possible?</p>