title: Finding conditional probability of trigram in python nltk
body: <p>I have started learning <code>NLTK</code> and I am following a tutorial from <a href="http://www.katrinerk.com/courses/python-worksheets/language-models-in-python" rel="noreferrer">here</a>, where they find conditional probability using bigrams like this.</p>
  
  <pre><code>import nltk
  from nltk.corpus import brown
  cfreq_brown_2gram = nltk.ConditionalFreqDist(nltk.bigrams(brown.words()))
  </code></pre>
  
  <p>However I want to find conditional probability using trigrams. When I try to change <code>nltk.bigrams</code> to <code>nltk.trigrams</code> I get the following error.</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "home/env/local/lib/python2.7/site-packages/nltk/probability.py", line 1705, in __init__
      for (cond, sample) in cond_samples:
  ValueError: too many values to unpack (expected 2)
  </code></pre>
  
  <p>How can I calculate the conditional probability using trigrams? </p>