#cmd /K "$(FULL_CURRENT_PATH)"
# -*- coding: utf-8 -*-
# Copyright 2018 Twitter, Inc.
# Licensed under the MIT License
# https://opensource.org/licenses/MIT

"""
Author: Zachary Nowak and Ethan Saari
Date: 01/03/2019

Program Description: Analyze the given
data for sentiment and return value

candidate, date, tweet, likes, replies, sentiment
"""
from paralleldots import set_api_key, similarity, ner, taxonomy, sentiment, keywords, intent, emotion, abuse
import json

def Sentiment(tweet):
	set_api_key("VIJL2MNSIraV6xzz2fNepEPdGX86Rxd7s0JvCqwqAEI")
	score = sentiment(tweet)
	data = json.dumps(score)

	result = data.split('{')[2]
	finalResult = result.split('}')[0]
	negative = score['probabilities']['negative']
	neutral = score['probabilities']['neutral']
	positive = score['probabilities']['positive']
	
	print(negative, neutral, positive)
	return(negative, neutral, positive)
	
if __name__== '__main__':
	import time
	new_dict = {}
	with open("Comstock Wexton tweets.txt", 'r') as fp:
		collection_of_tweets = json.load(fp)
		for date in collection_of_tweets.keys():
			appendBoi = []
			for tweet in collection_of_tweets[date]:
				try:
					time.sleep(3) #find value
					negative, neutral, positive = Sentiment(tweet[1])
					tweet.append(negative)
					tweet.append(neutral)
					tweet.append(positive)
					appendBoi.append(tweet)
					print(tweet)
				except IndexError:
					print("INDEXERROR")
					pass
				except TypeError:
					print("TYPEERROR")
					pass
			new_dict[date] = appendBoi
					
	print(new_dict)
	with open("Stuff", 'w') as fp:
		json.dump(new_dict, fp)
1bd04361fac2b37d8e8d0d6b9ff82878033dddf3
<mask token>

<mask token>


def Sentiment(tweet):
    set_api_key('VIJL2MNSIraV6xzz2fNepEPdGX86Rxd7s0JvCqwqAEI')
    score = sentiment(tweet)
    data = json.dumps(score)
    result = data.split('{')[2]
    finalResult = result.split('}')[0]
    negative = score['probabilities']['negative']
    neutral = score['probabilities']['neutral']
    positive = score['probabilities']['positive']
    print(negative, neutral, positive)
    return negative, neutral, positive


<mask token>

<mask token>


def Sentiment(tweet):
    set_api_key('VIJL2MNSIraV6xzz2fNepEPdGX86Rxd7s0JvCqwqAEI')
    score = sentiment(tweet)
    data = json.dumps(score)
    result = data.split('{')[2]
    finalResult = result.split('}')[0]
    negative = score['probabilities']['negative']
    neutral = score['probabilities']['neutral']
    positive = score['probabilities']['positive']
    print(negative, neutral, positive)
    return negative, neutral, positive


if __name__ == '__main__':
    import time
    new_dict = {}
    with open('Comstock Wexton tweets.txt', 'r') as fp:
        collection_of_tweets = json.load(fp)
        for date in collection_of_tweets.keys():
            appendBoi = []
            for tweet in collection_of_tweets[date]:
                try:
                    time.sleep(3)
                    negative, neutral, positive = Sentiment(tweet[1])
                    tweet.append(negative)
                    tweet.append(neutral)
                    tweet.append(positive)
                    appendBoi.append(tweet)
                    print(tweet)
                except IndexError:
                    print('INDEXERROR')
                    pass
                except TypeError:
                    print('TYPEERROR')
                    pass
            new_dict[date] = appendBoi
    print(new_dict)
    with open('Stuff', 'w') as fp:
        json.dump(new_dict, fp)

<mask token>
from paralleldots import set_api_key, similarity, ner, taxonomy, sentiment, keywords, intent, emotion, abuse
import json


def Sentiment(tweet):
    set_api_key('VIJL2MNSIraV6xzz2fNepEPdGX86Rxd7s0JvCqwqAEI')
    score = sentiment(tweet)
    data = json.dumps(score)
    result = data.split('{')[2]
    finalResult = result.split('}')[0]
    negative = score['probabilities']['negative']
    neutral = score['probabilities']['neutral']
    positive = score['probabilities']['positive']
    print(negative, neutral, positive)
    return negative, neutral, positive


if __name__ == '__main__':
    import time
    new_dict = {}
    with open('Comstock Wexton tweets.txt', 'r') as fp:
        collection_of_tweets = json.load(fp)
        for date in collection_of_tweets.keys():
            appendBoi = []
            for tweet in collection_of_tweets[date]:
                try:
                    time.sleep(3)
                    negative, neutral, positive = Sentiment(tweet[1])
                    tweet.append(negative)
                    tweet.append(neutral)
                    tweet.append(positive)
                    appendBoi.append(tweet)
                    print(tweet)
                except IndexError:
                    print('INDEXERROR')
                    pass
                except TypeError:
                    print('TYPEERROR')
                    pass
            new_dict[date] = appendBoi
    print(new_dict)
    with open('Stuff', 'w') as fp:
        json.dump(new_dict, fp)

#cmd /K "$(FULL_CURRENT_PATH)"
# -*- coding: utf-8 -*-
# Copyright 2018 Twitter, Inc.
# Licensed under the MIT License
# https://opensource.org/licenses/MIT

"""
Author: Zachary Nowak and Ethan Saari
Date: 01/03/2019

Program Description: Analyze the given
data for sentiment and return value

candidate, date, tweet, likes, replies, sentiment
"""
from paralleldots import set_api_key, similarity, ner, taxonomy, sentiment, keywords, intent, emotion, abuse
import json

def Sentiment(tweet):
	set_api_key("VIJL2MNSIraV6xzz2fNepEPdGX86Rxd7s0JvCqwqAEI")
	score = sentiment(tweet)
	data = json.dumps(score)

	result = data.split('{')[2]
	finalResult = result.split('}')[0]
	negative = score['probabilities']['negative']
	neutral = score['probabilities']['neutral']
	positive = score['probabilities']['positive']
	
	print(negative, neutral, positive)
	return(negative, neutral, positive)
	
if __name__== '__main__':
	import time
	new_dict = {}
	with open("Comstock Wexton tweets.txt", 'r') as fp:
		collection_of_tweets = json.load(fp)
		for date in collection_of_tweets.keys():
			appendBoi = []
			for tweet in collection_of_tweets[date]:
				try:
					time.sleep(3) #find value
					negative, neutral, positive = Sentiment(tweet[1])
					tweet.append(negative)
					tweet.append(neutral)
					tweet.append(positive)
					appendBoi.append(tweet)
					print(tweet)
				except IndexError:
					print("INDEXERROR")
					pass
				except TypeError:
					print("TYPEERROR")
					pass
			new_dict[date] = appendBoi
					
	print(new_dict)
	with open("Stuff", 'w') as fp:
		json.dump(new_dict, fp)