title: Difficulty converting a list: 'str' object has no attribute 'items'
body: <p>I am trying to create a classifier using NLTK, however, I believe that I have a problem in the format of my data that I cannot get over.</p>
  <p>My data looks like this:</p>
  <pre><code>data = [(&quot;TEXT 1&quot;, 'no'), (&quot;TEXT 2&quot;, 'yes'), (&quot;TEXT 3&quot;, 'no'), (&quot;TEXT 4&quot;, 'no'), (&quot;TEXT 5&quot;, 'yes')]
  </code></pre>
  <p>Then, I run the following code:</p>
  <pre><code> import nltk
      from nltk.classify import maxent
      
      classifier = maxent.MaxentClassifier.train(data, bernoulli=False, max_iter=10)
  </code></pre>
  <p>But, unfortunately I have the following error. What does this error consist of and how do I overcome it?</p>
  <pre><code>---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-93-e1b29adbeebb&gt; in &lt;module&gt;
  ----&gt; 1 classifier = maxent.MaxentClassifier.train(data, bernoulli=False, max_iter=10)
  
  /usr/local/lib/python3.8/dist-packages/nltk/classify/maxent.py in train(cls, train_toks, algorithm, trace, encoding, labels, gaussian_prior_sigma, **cutoffs)
      324         algorithm = algorithm.lower()
      325         if algorithm == &quot;iis&quot;:
  --&gt; 326             return train_maxent_classifier_with_iis(
      327                 train_toks, trace, encoding, labels, **cutoffs
      328             )
  
  /usr/local/lib/python3.8/dist-packages/nltk/classify/maxent.py in train_maxent_classifier_with_iis(train_toks, trace, encoding, labels, **cutoffs)
     1175     # Construct an encoding from the training data.
     1176     if encoding is None:
  -&gt; 1177         encoding = BinaryMaxentFeatureEncoding.train(train_toks, labels=labels)
     1178 
     1179     # Count how many times each feature occurs in the training data.
  
  /usr/local/lib/python3.8/dist-packages/nltk/classify/maxent.py in train(cls, train_toks, count_cutoff, labels, **options)
      665 
      666             # Record each of the features.
  --&gt; 667             for (fname, fval) in tok.items():
      668 
      669                 # If a count cutoff is given, then only add a joint
  
  AttributeError: 'str' object has no attribute 'items'
  </code></pre>