예제 #1
0
	def label_dict(self, handle): #Assemble classified tweets in a dict for ease of readability - see what the top ones are
		l_dict = {}
		predicted = self.classifier.predict(tweet_array(handle))
		labels = self.bin_labels.inverse_transform(predicted)
		for raw_label in labels:
			if raw_label:
				label = str(raw_label[0])	
				if label in l_dict.keys():
					l_dict[label] = l_dict[label] + 1
				else:
					l_dict[label] = 0
		return l_dict
예제 #2
0
	def classified_tweets(self, handle): #Gets classified tweets from a specific user
		predicted = self.classifier.predict(tweet_array(handle))
		labels = self.bin_labels.inverse_transform(predicted)
		return labels
예제 #3
0
def get_tweets_from_handle(handle):
	array = Reader.tweet_array(handle)
	return json.dumps(array)