Ejemplo n.º 1
0
from tweepy import Stream
from tweepy.streaming import StreamListener
from app.twitter import auth
from app import datasource, constants
from classifier import TwitterClassifier
import json
import time, datetime
from app import application

classer = TwitterClassifier()
classer.initialize(application.APP_ROOT + "/resources/flyers_tweets.txt", 100)

class MyListener(StreamListener):


    pos_tweets = []
    neg_tweets = []
    previous_time_chunk = 0

    def on_data(self, data):

        tweet = json.loads(data)

        now = datetime.datetime.now()


        time_chunk = now.strftime(constants.RECORD_TIME_FORMAT)
        print(time_chunk)

        print(tweet['text'])
Ejemplo n.º 2
0
from classifier import TwitterClassifier


classer = TwitterClassifier()

classer.initialize('/Users/dshuhler/projects/my_flask/app/resources/flyers_tweets.txt', 100)
classer.test_accuracy('/Users/dshuhler/projects/my_flask/app/resources/flyers_tweets.txt', 20)