1

I should train the model to determine gender of a name. I made the list like

[['Friedtic', 'Homer'], ['Alice', 'Miranda']]

I tried

classifier = nltk.NaiveBayesClassifier.train(train_data)

but there is the error

ValueError: too many values to unpack (expected 2)

A. Sokolov
  • 21
  • 2

1 Answers1

1

You need to structure your data into tuple items. Additionally, every item in your train set needs a label which tells the classifier to what class the name belongs. Finally, you need features that contain information on how to identify a name's (supposed) 'gender'.

The NLTK tutorials show how to structure your items, right under Gender Identification.

I could show you how, but this is quite clearly how the developers intended it.

lennyklb
  • 1,307
  • 2
  • 15
  • 32