-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ef5cbb
commit b4fa1da
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
polarity,subjectivity,tweet_text | ||
0,0,"RT @itti_Tigers: 📍 | | ||
لاعب الاتحاد @tareq_a3030 في احدى النوادي الخاصة بجدة استعداداً للموسم المقبل 💛🏋🏻♀️. https://t.co/PFjvRhHnq8" | ||
0.1,0.4,Rural naxals are getting defeated everyday hence urban naxals have decided to law in their own hands STOP… https://t.co/VJO3KGo8EP | ||
0,0,I shared my feedback on People's Pulse with PM Modi. You can do it now on the NaMo App! #SaafNiyatSahiVikas https://t.co/sM2qmpURL9 | ||
1,0.3,@RubikaLiyaquat congratulations ma'am yo and your #ZeeNewsNo1 team is the best marketing platform for MODI MARKETING. well done keep it up👍 | ||
0,0,"Why did you ask people to choose between a Mandir and a Masjid in Gujarath, then go on to say that you don't believ… https://t.co/LGnkYfazvd" | ||
-0.2,0.7,"No Credible Source to Modi’s Cong-Pak Collusion Remark: PMO on RTI. | ||
|
||
Let us take a moment to process this. The PM’… https://t.co/Tbwm1H5Zns" | ||
0.1625,0.975,"RT @INCIndia: No surprises here. We know PM Modi has a very vivid imagination. | ||
https://t.co/jh5nBklJTx" | ||
0,0,RT @dharmaites: 9) Secular HIndus are the ones who press NOTA and are Anti Modi | ||
0,0,"Government committed to ensuring affordable healthcare for all: PM Modi | ||
https://t.co/u29e3jcmOl | ||
|
||
via NaMo App https://t.co/dcWCojdvt1" | ||
0.3,0.1,"Assam entrepreneur wins accolade from PM Modi | ||
https://t.co/OfNLCQHvSk via NaMo App #StartupIndia is a success india… https://t.co/4I6Zi3t2rF" | ||
0,0,RT @SushantBSinha: पूर्व PM राजीव गांधी की तरह नरेंद्र मोदी को बम से उड़ाने की साज़िश रच रहे थे माओवादी https://t.co/yPnICbjdNd | ||
-0.125,0.375,"RT @51fini: Immigrazione, siete a favore dei respingimenti in mare? 🇮🇹 IMMEDIATAMENTE! Ne basteranno due o tre (nei modi giusti e senza ris…" | ||
0,0,@doctor_csr @Vidyaraj51 @ikaveri @narendramodi Tu tumhara modiya prachar mantri aur andhbhakt khali pili fakete kyu… https://t.co/x9dQ2hpTqa | ||
0.181481481,0.296296296,RT @RealMediaCrooks: There is a good reason to crack down heavily on urban Naxals... Shying away from these criminals will not do any good.… | ||
0,0,"मशहूर पत्रकार बरखा दत्त का छलका दर्द, बताया 'BJP और मोदी सरकार मुझे काम नहीं करने दे रहें हैं, मुझे https://t.co/DJlrMJ6Qnw" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import tweepy | ||
from textblob import TextBlob | ||
import pandas as pd | ||
import numpy as np | ||
consumer_key = 'Xqb4Qbaw3XyYPZcuse6RckE4R' | ||
consumer_secret = 'sa7ulPMnJUqDwhTQcrOvv309NAmo1cy9cHbee2AuJ5wThK9Sww' | ||
access_token = '783315261432528897-C05MZwp1xrpmYasxJS0i3yg6XpHAlUw' | ||
access_token_secret = 'ZgylLwHaai2taqlsAn4DJNISFAkqEtlcPBSoEweLsOwWt' | ||
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | ||
auth.set_access_token(access_token,access_token_secret) | ||
api = tweepy.API(auth) | ||
public_tweets = api.search('Modi') | ||
tweets = [] | ||
polarity = [] | ||
subjectivity = [] | ||
|
||
for tweet in public_tweets: | ||
analysis = TextBlob(tweet.text) | ||
tweets.append(tweet.text.encode('utf-8')) | ||
polarity.append(analysis.polarity) | ||
subjectivity.append(analysis.subjectivity) | ||
|
||
list_labels = ['tweet_text','polarity','subjectivity'] | ||
list_cols = [tweets, polarity, subjectivity] | ||
|
||
zipped = zip(list_labels,list_cols) | ||
#print zipped | ||
data = dict(zipped) | ||
dataset = pd.DataFrame(data) | ||
|
||
filename = 'labeled_tweet.csv' | ||
dataset.to_csv(filename, encoding='utf-8', index=False) |