title: Conditional Frequency Distribution using Browns Corpus NLTK Python
body: <p>I am trying to determine the words ending with 'ing' or 'ed'. Compute conditional frequency distibution, where condition is ['government', 'hobbies'] and the event is either 'ing' or 'ed'. Store the conditional frequency distribution in the variable inged_cfd.</p>
  <p>Below is my Code :-</p>
  <pre><code>from nltk.corpus import brown
  import nltk
  
  genre_word = [ (genre, word.lower())
                for genre in ['government', 'hobbies']
                for word in brown.words(categories = genre) if (word.endswith('ing') or word.endswith('ed')) ]
              
  genre_word_list = [list(x) for x in genre_word]
  
  for wd in genre_word_list:
      if wd[1].endswith('ing'):
        wd[1] = 'ing'
      elif wd[1].endswith('ed'):
        wd[1] = 'ed'
        
  inged_cfd = nltk.ConditionalFreqDist(genre_word_list)
          
  inged_cfd.tabulate(conditions = ['government', 'hobbies'], samples = ['ed','ing'])
  </code></pre>
  <p>I want to output to the in a tabular format, using this above code I am getting the output as :-</p>
  <pre><code>            ed  ing 
  government 2507 1605 
     hobbies 2561 2262
  </code></pre>
  <p>Whereas the actual output is :-</p>
  <pre><code>            ed  ing 
  government 2507 1474 
     hobbies 2561 2169
  </code></pre>
  <p>Kindly resolve my issue, and help me get the exact output.</p>