This is second part of my Twitter Sentiment Analysis & Botometer project blog. Where I will be explaining the process I used to perform a simple sentiment analysis on tweets (classifying if a tweet is either positive or negative).

Just to recap, Sentiment analysis is the process of assigning a numeric value, to a text, where the passage is rated as being positive, negative or neutral in sentiment (opinion or point of view). As a bonus I also used Botometer to perform a Twitter user bot detection, using Twitter’s API. Botometer is a package that can rate the likelihood a specific Twitter user is a bot or human, at a certain threshold.

Part 1 on obtaining a Twitter API (Application Programming Interface) credentials, can be found here:

OK so with my custom python file ( and Twitter API credentials and I can start with pulling tweets using python library ‘Tweepy’. But first we need to run the custom python file to load the hidden variables.

## Running file with my hidden Twitter API info
%run config/


Tweepy a open-sourced python library, hosted on GitHub and enables Python to communicate with Twitter to do a multiple of different actions by using its API. Tweepy can also help make a Twitter bot and automate actions like make a tweet, like a tweet or follow someone. But for this project I’m mainly using it to fish tweets to ran my analysis.

I authenticated to twitter using the OAuthHandler instance , passing my consumer API keys and Access tokens

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)

api = tweepy.API(auth)

The API class provides access to the entire twitter RESTful API methods. Each method can accept various parameters and return responses.

#api #botometer #twitter #python #sentiment-analysis

Twitter Sentiment Analysis & Botometer — Part 2
2.05 GEEK