title: How to get n-gram collocations and association in python nltk?
body: <p>In <a href="http://nltk.googlecode.com/svn/trunk/doc/howto/collocations.html" rel="noreferrer">this documentation</a>, there is example using <code>nltk.collocations.BigramAssocMeasures()</code>, <code>BigramCollocationFinder</code>,<code>nltk.collocations.TrigramAssocMeasures()</code>, and <code>TrigramCollocationFinder</code>.</p>
  
  <p>There is example method find nbest based on pmi for bigram and trigram.
  example: </p>
  
  <pre><code>finder = BigramCollocationFinder.from_words(
  ...     nltk.corpus.genesis.words('english-web.txt'))
  &gt;&gt;&gt; finder.nbest(bigram_measures.pmi, 10)
  </code></pre>
  
  <p>I know that <code>BigramCollocationFinder</code> and <code>TrigramCollocationFinder</code> inherit from <code>AbstractCollocationFinder.</code> While <code>BigramAssocMeasures()</code> and <code>TrigramAssocMeasures()</code> inherit from <code>NgramAssocMeasures.</code></p>
  
  <p>How can I use the methods(e.g. <code>nbest()</code>) in <code>AbstractCollocationFinder</code> and <code>NgramAssocMeasures</code> for 4-gram, 5-gram, 6-gram, ...., n-gram (like using bigram and trigram easily)?</p>
  
  <p>Should I create class which inherit <code>AbstractCollocationFinder</code>?</p>
  
  <p>Thanks.</p>