def __init__(self, text = ''): # prepare to use nltk_data path_to_nltk_data = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'nltk_data' ) nltk.data.path.append(path_to_nltk_data) # pre-processing tp = TextProcessor(text) self.text = tp.getProcessedText() # setup dictionaries corpus = Corpus() words = {} words['positive'] = corpus.positiveWordDict() words['negative'] = corpus.negativeWordDict() self.dictionaries = words