GithubHelp home page GithubHelp logo

guangzhixie / twitter-stream-word-count Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 961 KB

Ingest live tweets with Apache Storm and stores word count in Postgres database for analysis

Python 92.82% Clojure 7.18%
twitter-streaming-api apache-storm postgres streaming

twitter-stream-word-count's Introduction

Twitter Stream Word Count

Use Apache Storm to ingest live tweets from Twitter Stream API, and stores word count in Postgres database for further analysis


Application Architecture


See this document.


Steps to run the application


  1. Create AWS EC2 instance using UCB W205 AMI
  2. Make sure all the dependencies are there:
    • Python 2.7
    • virtualenv
    • lein
    • streamparse
    • psycopg2
    • tweepy
    • redis
  3. Start Postgres DB
  4. Download the project folder to your preferred location
  5. Go into the project folder
  6. Run dbsetup python script to create databse and table: $ python dbsetup.py
  7. Go into tweetwordcount folder: $ cd tweetwordcount
  8. Run storm application: $ sparse run
  9. You may see the following warning:
    • WARNING: You're currently running as root; probably by accident.
    • Press control-C to abort or Enter to continue as root.
    • Set LEIN_ROOT to disable this warning.
  10. Just press enter to continue
  11. Application should be running now. You can exit with Ctrl-C

Steps to run the serving scripts


  1. Go into the project folder
  2. Go into serves folder $ cd serves
  3. Get all the words with their total count of occurrences, sorted alphabetically in an ascending order: $ python finalresults.py
  4. Get counts for a particular word: $ python finalresults.py [your word]
  5. Get counts for a range ordered by their total number of occurrences: $ python histogram.py [lower],[upper]

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.