title: spaCy: Finding the sentences from which tokens extracted with dependency matcher come from
body: <p>I have a list of tuples right here that represent dependency patterns extracted with spacy dependency matcher :</p>
  <pre><code>dep_patterns =[('nsubj_verb', rabbits, jumping),
                 ('nsubj_verb', grass, getting),
                 ('nsubj_verb', they, come)
                ]
  </code></pre>
  <p>Just in case, here is part of text file I'm working with:</p>
  <pre><code>text_file = &quot;The rabbits are jumping in the garden. The grass is getting shorter and shorter by the day. Every evening, they come to this garden at the same time.&quot;
  </code></pre>
  <p>I'm trying to get the full sentences from which these patterns were extracted. I know I can use token.sent to find the sentence from which a token comes from but I'm running into problems trying to implement that solution.</p>
  <p>I tried this code</p>
  <pre><code>for pattern in text_for_patterns:
      (pattern_name, subject, verb) = pattern
      for subject, verb in pattern[1:2]:
          sents = (subject.text, verb.text).sent
          comp_sentences.append(sents)
  </code></pre>
  <p>but I keep getting this error:</p>
  <pre><code>--------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-87-5c4560e7ea5d&gt; in &lt;module&gt;
       22 for pattern in text_for_patterns:
       23     (pattern_name, subject, verb) = pattern
  ---&gt; 24     for subject, verb in pattern[1:2]:
       25         sents = (subject.text, verb.text).sent
       26         comp_sentences.append(sents)
  
  TypeError: cannot unpack non-iterable spacy.tokens.token.Token object
  </code></pre>
  <p>There might be a couple of things I'm missing here, but after spending some time thinking about it and Googling, I'm running of ideas...</p>