Naive base classifier of nltk giving unhashable type error
问题 Following is the code that I wrote using nltk and Python. import nltk import random from nltk.corpus import movie_reviews #from sklearn.naive_bayes import GaussianNB documents = [(list(movie_reviews.words(fileid)), category) for category in movie_reviews.categories() for fileid in movie_reviews.fileids(category)] random.shuffle(documents) #print(documents[1:3]) all_words= [] for w in movie_reviews.words(): all_words.append(w.lower()) all_words = nltk.FreqDist(all_words) #print(all_words.most