Provides a look at a user's polarity and subjectivity on twitter using the TextBlob library
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
twitter-persona.py

README.md

TwitterPersonality

Provides a look at a user's polarity and subjectivity on twitter using the TextBlob library

Prerequisites

  1. Install the Natural Language Toolkit from its website
  • Make sure you install all of NLTK's prerequisites
  1. Install TextBlob from its website
  2. Install Tweepy using the instructions on their GitHub page
  • You can either use pip install tweepy or

         git clone https://github.com/tweepy/tweepy.git
         python setup.py install
    

Using

  1. Make sure you have a consumer key and secret generated by registering for a new api key on Twitter's developer page
  2. From the terminal, type python [path/to/twitter-persona.py] [key] [secret] [user_to_analyze] [tweet_count] [include_retweets]
  • Make sure you replace the objects in brackets with valid values
  • Twitter's API will return at most 800 tweets.

Example

This is an example of what results from running the script using @macklemore:

python twitter-persona.py [redacted_key] [redacted_secret] "Macklemore" 500 False

Average Polarity of Tweets: 0.151289301423
Average Subjectivity of Tweets: 0.347877407229
Most Negative Tweet: I picked the wrong night to drink 2 energy drinks.... Can't sleep.  Can't wait.  LETS GO!!!!!!! #seahawks http://t.co/YHfWiM7t4L
Most Positive Tweet: Leonardo blocking out the haters. He can't see you. My best friend. #pals #animals&me #fox #vintageGǪ http://t.co/LEDfOuEJTW
Most Objective Tweet: Seahawks plane headed to NYC.....TURN UP!!!!!!! #superbowl #seahawks http://t.co/fM6JpfnT7H
Most Subjective Tweet: SEATTLE... I'm pumped to announce that for our Key Arena show on the 11th we're bringing out Sir Mix-AGǪ http://t.co/v3XMmvD6hT