Code Monkey home page Code Monkey logo

tweetalytics's Introduction

Tweetalytics

Welcome to Tweetalytics! This is a tool for collecting and analyzing tweets.

Setup

1. Create a Twitter Account

2. Sign into Twitter Developers with your Twitter Account

3. Create a Twitter Application

4. Set the Access Level to "Read and write"

5. Create an Access Token

6. Install oauth

sudo gem i oauth

7. Install twurl

sudo gem i twurl

8. Begin the authorization of your Twitter account to make API requests

twurl authorize --consumer-key key --consumer-secret secret
  • key is your application's consumer-key

  • secret is your application's consumer-secret

9. Enter the returned URL into your browser

10. Click "Authorize app"

11. Enter the returned PIN back into the terminal

12. Download this repository

Getting Started

To begin using this tool, make sure your current directory is the tweetalytics repository and type in the following command:

irb -r ./Run.rb

Collect Tweets

There are two ways to collect tweets: first, by specifying a bounding box, which is an array that consists of bottom-left-longitude, bottom-left-latitude, top-right-longitude, and top-right-latitude coordinates, and second, by specifying a certain keyword you want to track.

How to stream tweets from a certain location

Use the collect function and specify how many tweets you want, the name of the file you will create, and a bounding box.

For example:

> collect(25, "tweets", United_States)

How to track a certain keyword

Use the collect function and specify how many tweets you want, the name of the file you will create, and the keyword.

For example:

> collect(25, "tweets", "obama")

Load Tweets

The next thing to do is to load the tweets you just collected into Ruby.

How to load tweets in a JSON file into Ruby

For example:

> tweets = load("tweets")

Process Tweets

Now process the tweets you just loaded in.

How to process tweets

For example:

> processed_text = process(tweets)

or if you don't want to process the tweets:

> raw_text = get_raw_text(tweets)

Analyze Tweets

Then analyze the tweets.

How to run a character analysis

For example:

> character_statistics = character_analysis(raw_text)

How to find the most popular words in a set of tweets.

For example:

> most_popular_words = top_words(5, processed_text)

Commands for fun

How to post a tweet

  • Use the post function and specify your tweet.

For example:

>>> post("Hello World!")

License

The MIT License (MIT)

Copyright (c) 2014 Paul Land

Problems

If you find any issues please report them or send a pull request.

tweetalytics's People

Contributors

paul-land avatar darenzhang94 avatar mmaloo avatar

Watchers

James Cloos avatar Martin Baker avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.