Sentiment Analysis From tweeter
Sentiment Analysis : Understanding and Extracting Feelings From Data
An API lets you access an apps functionality from your code
Note : go to tweeter developer and generate secrete key , secrete access key,
access token key , and access secrate token key
TextBlob is awesome for NLP task
pip install tweepy
pip install textblob
import tweepy from textblob import TextBlob c_k="ZTLY86W4SB7x8f5AsDrTYcIDG"c_s="n4dWcwOYz19XS7FGRKWJt45jumtdHhw7njbKU64r3C0sMmAj8W"a_t="497554636-3fXu3jG70a8P4sICR88Dnr8TYmMEKQn3LDVM6jiE"a_t_s="GPfOWs5WH5cTWmUQs4O1BRPy3LPwkbFhmhtOABdjLZDEc"auth=tweepy.OAuthHandler(c_k , c_s) auth.set_access_token(a_t, a_t_s) api = tweepy.API(auth) public_tweets = api.search("Amit Shah") for tweet in public_tweets: print(tweet.text) analysis=TextBlob(tweet.text) print(analysis.sentiment)
Comments
Post a Comment