Пример #1
0
                                          tc=args.tweet_count,
                                          st=args.search_type,
                                          ud=args.since_date,
                                          lan=args.language)
    opin_dict = tClient.opinion_mining(search_results['statuses'])
    '''
    te_search_results = twitter.search(q=keyword, count=tweet_count, result_type='mixed', since_id=since, lang="te")

    trans = Translator()
    for result in te_search_results['statuses']:
        print result['text']
        trans.translate(result['text'])
    '''
else:
    multi_search_results = tClient.multi_search_until(k=args.keyword,
                                                      ud=args.since_date,
                                                      lan=args.language)
    opin_dict = tClient.opinion_mining_multi(multi_search_results)

while True:
    print "Print 1)Positive 2)Negative 3)Netral 4)Exit \n "
    option = input("Enter option(1/2/3/4)")

    opted_dict = {}
    if option == 1:
        opted_dict = opin_dict['positive']
    elif option == 2:
        opted_dict = opin_dict['negative']
    elif option == 3:
        opted_dict = opin_dict['neutral']
    elif option == 4:
Пример #2
0
parser.add_argument("since_date", help = "The date from which tweets should be analyzed")
parser.add_argument("-v", "--verbose", help = "Print traces for debugging", type=bool, default=False)
### End of arguments ###

####main####
args = parser.parse_args()
tClient = TwitterClient()

ReviewRules = [('VeryGood' , 90),
               ('Good'     , 80),
               ('Watchable', 70),
               ('Average'  , 60),
               ('Bad'      , 30),
               ('VeryBad'  ,  0)]

multi_search_results = tClient.multi_search_until(k=args.Movie, ud=args.since_date, verbose=args.verbose)
total_tweets, opinion_dictionary = tClient.review_mining_multi(multi_search_results, ReviewRules)

'''
opinion dictionary is a dictionary of dictionaries has the following structure

{Sentiment : {tweet_id: tweet_text}}

ex: {'VeryGood' : { 1 : "Must Watch",
                    2 : "Top Notch" } } 

'''
result_summary_dictionary = OrderedDict({int: [str,(float, int)]})
'''
{SentimentSNo:[Sentiment, 
                (approved percetage(percentage of tweets who approved this rating),