title: How to get PMI scores for trigrams with NLTK Collocations? python
body: <p>I know how to get bigram and trigram collocations using NLTK and I apply them to my own corpora. The code is below. </p>
  
  <p>My only problem is how to print out the birgram with the PMI value? I search NLTK documentation multiple times. It's either I'm missing something or it's not there. </p>
  
  <pre><code>import nltk
  from nltk.collocations import *
  
  myFile = open("large.txt", 'r').read()
  myList = myFile.split()
  myCorpus = nltk.Text(myList)
  trigram_measures = nltk.collocations.TrigramAssocMeasures()
  finder = TrigramCollocationFinder.from_words((myCorpus))
  
  finder.apply_freq_filter(3)
  print finder.nbest(trigram_measures.pmi, 500000)
  </code></pre>