def test_calculate_sentiment(): """ tests calculate_tweet_sentiment """ tweet_dic = ts.create_sentiment_dictionary(open('AFINN-111.txt')) tweet_list = ts.parse_tweets(open('problem_1_submission.txt')) for tweet in tweet_list: print(ts.calculate_tweet_sentiment(tweet, tweet_dic))
def test_dic_conversion(): """ Test create_sentiment_dictionary """ sent_file = open('AFINN-111.txt') sent_dic = ts.create_sentiment_dictionary(sent_file) ctr = 0 for key in sent_dic: print(str(key) + ", " + str(sent_dic[key])) if ctr > 5: break ctr += 1 sent_file.close()