I have extracted keywords from the wikipedia article of movie Casino and generated feature set in which key:value pair is keyword:keyword . So , both feature name and feature value are same .i have labeled the feature set as "DRAMA" and "CRIME" making a list of tuple (featureset,label) .then I gave the labeled feature set as the trained input to Naive Bayes Classifier. After this , I try to classify the new feature set (example : {'roxy': 'roxy', 'sports': 'sports', 'wan': 'wan'} but it ignores the new feature set and does not return any label .
def feature_gen(wiki_dict, mt_movie):
temp = [(wiki_dict, label.strip('\n')) for label in fileinput.input(mt_movie)]
train(temp)
def train(train_sets):
global classifier
classifier = nltk.NaiveBayesClassifier.train(train_sets)
url = [ "http://en.wikipedia.org/wiki/Casino_(film)" ]
mt_list = ['casino.txt']
classifier.classify( {'roxy': 'roxy', 'sports': 'sports', 'wan': 'wan'})