I have try the code from here: Save Naive Bayes Trained Classifier in NLTK. I want to classify tweet into positive class or negative class. this is my code:
I don't have the environment setup to test out your code, but I have the feeling it's not right in the part where you save/load the pickle.
Referring to the Storing Taggers section of the NLTK book, I would change your code and do it like this:
def save_classifier(classifier):
f = open('my_classifier.pickle', 'wb')
pickle.dump(classifier, f, -1)
f.close()
def load_classifier():
f = open('my_classifier.pickle', 'rb')
classifier = pickle.load(f)
f.close()
return classifier
Hope it helps.