title: How can I classify data into multiple categories using Naive Bayes?
body: <p>I am trying to classify sentences into various sentiments(there are eight of them), but I get this error when I run my code. Sorry, I'm really new to Python, so I'm not exactly sure what is happening here.</p>
  
  <pre><code>ValueError                                
  Traceback (most recent call last)
  &lt;ipython-input-66-40fb2c79238c&gt; in &lt;module&gt;
        18 test_data = data[4800:]
        19 
  ---&gt;  20 classfier= nltk.NaiveBayesClassifier.train(train_data)
        21 print(nltk.classify.accuracy(classifier, test_data)) 
  
  
    ~/anaconda3/lib/python3.7/site-packages/nltk/classify/naivebayes.py in train(cls, labeled_featuresets, estimator)
  204         # Count up how many times each feature value occurred, given
  205         # the label and featurename.
  --&gt; 206         for featureset, label in labeled_featuresets:
  207             label_freqdist[label] += 1
  208             for fname, fval in featureset.items():
  
  ValueError: too many values to unpack (expected 2)
  </code></pre>
  
  <hr>
  
  <p>This is my original code:</p>
  
  <pre><code>import nltk
  import pandas as pd
  import csv
  import numpy as np
  from sklearn.model_selection import train_test_split
  
  import pandas as pd
  import numpy as np
  
  import random
  
  with open("/Users/mac/Documents/Transcribed.rtf", "rb") as f:
  data = f.read().split()
  
  random.shuffle(data)
  
  train_data = data[:1200]
  test_data = data[4800:]
  
  classfier= nltk.NaiveBayesClassifier.train(train_data)
  print(nltk.classify.accuracy(classifier, test_data))
  </code></pre>