Skip to content

Commit 11c352c

Browse files
authored
Merge branch 'master' into master
2 parents cd49226 + 0c6fd3b commit 11c352c

File tree

146 files changed

+68970
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+68970
-96
lines changed

.DS_Store

0 Bytes
Binary file not shown.

SentimentAnalysis.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
import twitter
1010
import pandas as pd
1111

12-
nltk.download('stopwords')
13-
nltk.download('punkt')
14-
nltk.download('vader_lexicon')
15-
1612
def preprocess_texts(texts):
1713
preprocessed_text = []
1814
stop_words = stopwords.words('english')
@@ -45,13 +41,13 @@ def uploaded_file(path):
4541
print(df.head())
4642

4743
def fetch_tweets(keyword,num_of_tweets):
48-
text = twitter.get_tweets(keyword,num_of_tweets)
49-
44+
time_stamp,location_list,twitter_user,tweet_list = twitter.get_tweets(keyword,num_of_tweets)
5045
print("successfuly obtained tweets")
51-
prep_text = preprocess_texts(text)
46+
prep_text = preprocess_texts(tweet_list)
5247
labels = Predict(prep_text)
53-
54-
for i,j in zip(text,labels):
48+
df = pd.DataFrame(list(zip(time_stamp,location_list,twitter_user,tweet_list, labels)), columns =['time_stamp','location','user name','text', 'val'])
49+
df.to_csv('file.csv',index=False)
50+
for i,j in zip(tweet_list,labels):
5551
print(i)
5652
print("\n\n")
57-
print(j)
53+
print(j)
143 Bytes
Binary file not shown.

__pycache__/twitter.cpython-37.pyc

822 Bytes
Binary file not shown.

file.csv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
time_stamp,location,user name,text,val
2+
2020-04-07 08:20:07,India,Pritul Doshi,"_Doshi Hi! That's not the experience we want you to have. Kindly DM us your Vodafone and an alternate contact number, so that we can have this checked and update you shortly - Sara",1
3+
2020-04-07 06:35:50,,Vodafone,Ya but why the networks are down,1
4+
2020-04-07 06:34:14,India,Pritul Doshi,"_Doshi Hello! In view of the countrywide lockdown, we are operating with limited staff and our responses will be delayed. Please log in to My Vodafone App or visit for all payments, recharges & service queries. Stay Home, Stay Safe!",1
5+
2020-04-07 06:34:09,,Vodafone,", there is no network in Mumbai area for last 15 minutes",1
6+
2020-04-06 07:29:34,"Pune, India",Pyscho Magnet,Thank you Pritul. 😊 #lockdownBirthday going good so far.,1

flask_main.py

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import pandas as pd
44
import SentimentAnalysis
55
app = Flask(__name__)
6-
6+
SIZE=0
77

88
@app.route('/')
9-
@app.route('/test')
9+
@app.route('/test.html')
1010
def test():
1111
return render_template('test.html')
1212

@@ -16,24 +16,64 @@ def excel():
1616

1717
@app.route('/keyword.html', methods=['GET', 'POST'])
1818
def keyword():
19+
data={'username':"2"}
1920
if request.method == "POST":
20-
SentimentAnalysis.fetch_tweets(request.form['fetch_tweet'],10)
21-
return render_template('keyword.html')
21+
global SIZE
22+
print(SIZE)
23+
input("skjvnksdjvn")
24+
if request.form['fetch_tweet']==" ":
25+
return render_template('keyword.html',data=data)
26+
SentimentAnalysis.fetch_tweets(request.form['fetch_tweet'],SIZE)
27+
return render_template('keyword.html',data=data)
2228
else:
2329
return render_template("keyword.html")
2430

2531

26-
@app.route('/upload.html',methods=['GET', 'POST'])
32+
@app.route('/excel.html',methods=['GET', 'POST'])
2733
def upload_route_summary():
2834
if request.method == 'POST':
29-
30-
# Create variable for uploaded file
3135
f = request.files['fileupload']
3236
print(f)
37+
input()
3338
THIS_FOLDER = os.path.dirname(os.path.abspath(__file__))
3439
filename_path = os.path.join(THIS_FOLDER, f.filename)
3540
SentimentAnalysis.uploaded_file(filename_path)
36-
return render_template('excel.html')
41+
data={'username':"1"}
42+
return render_template('excel.html',data=data)
43+
44+
45+
@app.route('/tweet.html',methods=['GET', 'POST'])
46+
def tweets_number():
47+
if request.method == 'POST':
48+
global SIZE
49+
# Create variable for uploaded file
50+
f = request.form['fetch_tweet_num']
51+
SIZE=f
52+
print(SIZE)
53+
data={'username':"2"}
54+
return render_template('excel.html',data=data)
55+
56+
57+
@app.route('/button.html',methods=['GET', 'POST'])
58+
def button_click():
59+
print('button_file_upload' in request.form)
60+
#input()
61+
if request.method == 'POST':
62+
if 'button_file_upload' in request.form:
63+
data={'username':"1"}
64+
return render_template('excel.html',data=data)
65+
elif 'twitter_num_button' in request.form:
66+
data={'username':"2"}
67+
return render_template('excel.html',data=data)
68+
69+
70+
@app.route('/pastdata.html')
71+
def past_data():
72+
return render_template('pastdata.html')
73+
74+
@app.route('/dataanalysis.html')
75+
def data_analysis():
76+
return render_template('dataanalysis.html')
3777

3878

3979

static/chart1.jpeg

59.3 KB

static/css/adminStyle.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
body{
2+
font-family: 'Ubuntu', sans-serif;
3+
}
4+
5+
.nav-sidebar{
6+
margin: 40px -20px 20px 20px;
7+
}
8+
9+
.nav-sidebar >li >a{
10+
padding: 20px 20px;
11+
}
12+
13+
.main{
14+
margin-top: -20px;
15+
}
16+
17+
.placeholders{
18+
margin-top: 10px;
19+
margin-bottom: 30px;
20+
text-align: center;
21+
}
22+
23+
.placeholder img{
24+
display: inline;
25+
border-radius: 50%;
26+
}

0 commit comments

Comments
 (0)