title: Using nltk collocations as features in scikit-learn
body: <p>I am trying to extract collocations using nltk from a corpus an then use their occurrences as features for a scikit-learn classifier.
  Unfortunately I am not so familiar with nltk and I don't see an easy way to do this.
  I got this far:</p>
  
  <ul>
  <li>extract collocations using <code>BigramCollocationFinder</code> from corpus</li>
  <li>for each document, extract all bigrams (using <code>nltk.bigrams</code>) and check if they are one of the collocations</li>
  <li>create a <code>TfidfVectorizer</code> with an analyzer that does nothing</li>
  <li>feed it the documents in form of the extracted bigrams</li>
  </ul>
  
  <p>That seems pretty overcomplicated to me. Also it has the problem that the <code>BigramCollactionFinder</code> has a <code>window_size</code> parameter for bigrams that span over words. The standard <code>nltk.bigrams</code> extraction can not do that.</p>
  
  <p>A way to overcome this would be to instantiate a new BigramCollocationFinder for each document and extract bigrams again and match them against the ones I found before... but again, that seems way to complicated.
  Surely there is an easier way to do that, that I overlook.</p>
  
  <p>Thanks for your suggestions!</p>