title: Count most commonly used phrases from a `.txt` file
body: <p>I have been trying to use nltk in Python to find the most commonly used phrases from a text file. Here is my code:</p>
  <pre class="lang-py prettyprint-override"><code>import nltk
  from nltk.collocations import*
  
  bigram_measures = nltk.collocations.BigramAssocMeasures()
  trigram_measures = nltk.collocations.TrigramAssocMeasures()
  finder = BigramCollocationFinder.from_words('comments.txt')
  
  finder.apply_freq_filter(2)
  finder.nbest(bigram_measures.pmi, 20)
  </code></pre>
  <p><a href="https://www.nltk.org/howto/collocations.html" rel="nofollow noreferrer">Source: nltk.org</a>.</p>
  <p>When I input this code, I get nothing. I tried another <code>.txt</code> file and it still doesn’t work. Am I doing something wrong?</p>