Sentiment Analysis

This project analyses the sentiment This is the task of - day 3 in MLH LHD check this out :

import tweepy
from textblob import TextBlob

print('Sentimental Analysis')
""" Sentimential Analysyis is used to measure the polarity of a given text 
    Algorithm Natural Language Processing is used where a given text is divided into Lexiams or 
    token and each token is seperatly analysed
    Enter the key1,key2,Auth1,Auth2 given via twitter"""
auth = tweepy.OAuthHandler('key1','key2')
#To auth the developer
auth.set_access_token('Auth1','Auth2')
#to access the api created by a app via twitter
api = tweepy.API(auth)
#authorization 
search_tweet = api.search('MachineLearning')

#searching tweets which has keyword 'MachineLearning' 
for tweet in search_tweet:
    #Itterating to all the posiable searched tweets 
    print(tweet.text)
    #printing the tweets which has the keyword "Machine Learning"
    analysis = TextBlob(tweet.text)
    #all the text are initialised onto analysis using Textblob Libraries
    print(analysis.sentiment)

Built With

  • pyhon
Share this project:

Updates