parser.add_argument('-t', '--tweets_path', help='tweets path', default='data/rawdata/', type=str) parser.add_argument('-f', '--dest_file', help='File where is stored the model', default='classifier', type=str) args = parser.parse_args() # Process the training of the model print "Initialization" s = SetManager(args.csv_path, args.tweets_path) tokenizer = Tokenizer(preserve_case=False) cm = ClassifierManager() # List of the sentiments used (feature space) sentiments = ['Virtue', 'Weak', 'HU', 'Hostile', 'EnlTot', 'ComForm', 'Passive', 'Pstv', 'Ngtv', 'PowTot', 'Strong', 'Positiv', 'IAV', 'Active', 'Negativ'] sentiments.reverse() classifiers = {} print "DB connexion" con = None try: db, usr, pwd = load_database('database.properties') con = psycopg2.connect(database=db, user=usr, host='localhost')
result = max(predictions.iterkeys(), key=(lambda k: predictions[k])) if result == 'neg': return -1 elif result == 'neut': return 0 else: return 1 return max(predictions.iterkeys(), key=(lambda k: predictions[k])) # return predictions args = parser.parse_args() print "Initialization" s = SetManager(args.csv_path, args.tweets_path) tokenizer = Tokenizer(preserve_case=False) cm = ClassifierManager() # List of the sentiments used (feature space) sentiments = ['Virtue', 'Weak', 'HU', 'Hostile', 'EnlTot', 'ComForm', 'Passive', 'Pstv', 'Ngtv', 'PowTot', 'Strong', 'Positiv', 'IAV', 'Active', 'Negativ'] sentiments.reverse() classifiers = {} print "DB connexion" con = None testingSet = None try: db, usr, pwd = load_database('database.properties') con = psycopg2.connect(database=db, user=usr, host='localhost')