· 6 years ago · Sep 08, 2019, 02:52 PM
1"""
2Text Recognition ==> Sentiment Analysis
3
4 *Subjectivity
5 *Emotion
6 Ex: Thank you (Could be positive or negative)
7
8Twitter ==> TweePy
9Signup ==> developer.twitter.com (2 - 7 Days key delivery)
10TextBlob ==> Sentiment Analysis
11
12Recommendation System
13
14------------
15"""
16import tweepy as tp
17from textblob import TextBlob as tb
18
19consumer_key = 'YtvPDRY55KpZjNdBcsMVI99M3'
20consumer_secret = 'D8jd9eImGg9MDE6BUGz84rRY2JNWw5dFXWnSsfcSGcdvFzC5Js'
21
22access_token = '878266548661760002-2EaJhUc8mKc19EjizMvr7RU9gGZ0H0s'
23access_token_secret = 'cBupYj8AHwpTYzepxqKhSijprjjaXQ2AmhC90BGcNEZtu'
24
25# Connect to server
26auth = tp.OAuthHandler(consumer_key, consumer_secret)
27# Connect to twitter database
28auth.set_access_token(access_token, access_token_secret)
29
30api = tp.API(auth)
31
32tweets = api.search('Trump')
33
34c = 0
35for t in tweets:
36 print(t.text)
37 sa = tb(t.text)
38 print(sa.sentiment)
39 print('===================')
40 c += 1
41 print(c)
42
43# RNN
44
45import numpy as np
46import pandas as pd
47from sklearn import tree
48
49data = pd.read_csv('gender.csv')
50clf = tree.DecisionTreeClassifier()
51x = data[['Height', 'Weight', 'Shoe_Size']]
52y = data['Gender']
53
54clf.fit(x, y)
55h = int(input("Height"))
56w = int(input("Weight"))
57s = int(input("Shoe_Size"))
58
59pr = clf.predict([[h, w, s]])
60print(pr)
61
62
63========================
64
65Gender,Height,Weight,Shoe_Size
66Male,181,80,44
67Male,177,70,43
68Female,160,60,38
69Female,154,54,37
70Male,166,65,40
71Male,190,90,47
72Female,175,64,39
73Female,177,70,40
74Female,159,55,37
75Male,171,75,42
76Male,181,85,43