nltk.trigams has no count attribute
<p>I'm running <code>Python-3.x</code> on a <code>virtualenv</code>, trying to process text with <code>nltk</code>.</p>

<p>I saw this post <a href="https://stackoverflow.com/questions/12821201/what-are-ngram-counts-and-how-to-implement-using-nltk" title="What are ngram counts">What are ngram counts...</a> and the most upvoted answer has a bit of code using the <code>count()</code> method. but when I copy/paste it into mine:</p>

<pre><code>import nltk
from nltk import bigrams
from nltk import trigrams

text="""Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ornare
tempor lacus, quis pellentesque diam tempus vitae. Morbi justo mauris,
congue sit amet imperdiet ipsum dolor sit amet, consectetur adipiscing elit. Nullam ornare
tempor lacus, quis pellentesque diam"""

tokens = nltk.word_tokenize(text)
tokens = [token.lower() for token in tokens if len(token) &gt; 1]
bi_tokens = bigrams(tokens)
tri_tokens = trigrams(tokens)

print [(item, tri_tokens.count(item)) for item in sorted(set(tri_tokens))]
</code></pre>

<p>I receive this message:</p>

<pre><code>AttributeError: 'generator' object has no attribute 'count'
</code></pre>

<p>I see <a href="https://stackoverflow.com/questions/33784637/missing-count-method-in-tkinters-text-widget">this other post</a> on a monkeypatch for a count method but feel like that's somehow not related. Any idea what I might be doing wrong?</p>