Code Monkey home page Code Monkey logo

tweetanalyzer's Introduction

TweetAnalyzer

Collects news articles for trending topics

Dependencies:

  1. Twitter4j 4.0.3
  2. Selenium Java Driver 2.44.0
  3. Selenium Html Unit Driver 2.44.0
  4. Selenium Server Standalone Driver 2.44.0
  5. Selenium Remote Driver 2.44.0
  6. Mongo Java Driver 3.0.0

To run the project the following files should be executed in order:

  1. GetLatestTweets.java
  2. Scraper.java
  3. NaiveNLPComparator.java
  4. TestArticles.java This will create a file "output.txt" which has Trend Names and the article links and descriptions.

On Linux, the following command can be executed from the project folder, to run the project javac -cp ".:dependencies/lib/mongo-java-driver-3.0.0.jar:dependencies/lib/twitter4j-core-4.0.3.jar:dependencies/lib/selenium-java-2.44.0.jar:dependencies/lib/selenium-remote-driver-2.44.0.jar:dependencies/lib/selenium-api-2.44.0.jar:dependencies/lib/selenium-server-standalone-2.44.0.jar:dependencies/lib/selenium-firefox-driver-2.44.0.jar:dependencies/lib/selenium-htmlunit-driver-2.44.0.jar" src/NameHelper.java src/GetLatestTweets.java src/Scraper.java src/NaiveNLPComparator.java src/TestArticles.java java -cp ".:dependencies/lib/mongo-java-driver-3.0.0.jar:dependencies/lib/twitter4j-core-4.0.3.jar:dependencies/lib/selenium-java-2.44.0.jar:dependencies/lib/selenium-remote-driver-2.44.0.jar:dependencies/lib/selenium-api-2.44.0.jar:dependencies/lib/selenium-server-standalone-2.44.0.jar:dependencies/lib/selenium-firefox-driver-2.44.0.jar:dependencies/lib/selenium-htmlunit-driver-2.44.0.jar:src/.class:./src" GetLatestTweets java -cp ".:dependencies/lib/mongo-java-driver-3.0.0.jar:dependencies/lib/twitter4j-core-4.0.3.jar:dependencies/lib/selenium-java-2.44.0.jar:dependencies/lib/selenium-remote-driver-2.44.0.jar:dependencies/lib/selenium-api-2.44.0.jar:dependencies/lib/selenium-server-standalone-2.44.0.jar:dependencies/lib/selenium-firefox-driver-2.44.0.jar:dependencies/lib/selenium-htmlunit-driver-2.44.0.jar:src/.class:./src" Scraper java -cp ".:dependencies/lib/mongo-java-driver-3.0.0.jar:dependencies/lib/twitter4j-core-4.0.3.jar:dependencies/lib/selenium-java-2.44.0.jar:dependencies/lib/selenium-remote-driver-2.44.0.jar:dependencies/lib/selenium-api-2.44.0.jar:dependencies/lib/selenium-server-standalone-2.44.0.jar:dependencies/lib/selenium-firefox-driver-2.44.0.jar:dependencies/lib/selenium-htmlunit-driver-2.44.0.jar:src/.class:./src" NaiveNLPComparator java -cp ".:dependencies/lib/mongo-java-driver-3.0.0.jar:dependencies/lib/twitter4j-core-4.0.3.jar:dependencies/lib/selenium-java-2.44.0.jar:dependencies/lib/selenium-remote-driver-2.44.0.jar:dependencies/lib/selenium-api-2.44.0.jar:dependencies/lib/selenium-server-standalone-2.44.0.jar:dependencies/lib/selenium-firefox-driver-2.44.0.jar:dependencies/lib/selenium-htmlunit-driver-2.44.0.jar:src/.class:./src" TestArticles

Algorithm:

  1. Get the 10 latest trends at NYC from twitter.
  2. For each trend get 4 most popular tweets and store in database.
  3. Scrape the news section of huffingtonpost.com, to get all the news article links along with the short description. Only the news sub-section is scrapped.
  4. Store these in a database.
  5. NaiveNLPComparator retrieves the trends and the tweets from the database.
  6. Every tweet is processed by removing stop words and a frequency table is created. Here the words which have a high frequency ultimately induces a high weight to an article.
  7. For each article in the database, the description is matched with the frequency table to get a weight.
  8. If this weight is 50% of the cumulative frequencies for a trend it is added to a Success table.
  9. Else it is dumped in a failure table along with the trend_id, news_article, news_link and the weight it received.
  10. TestArticles retrieves from the success table in descending order of weights (if there are no results) then the failure table is queried.
  11. All news articles and links whose weight is not 0 are retrived in descending order of weights.
  12. These are written into output.txt

Possible Improvements:

  1. Could query for more than 4 tweets, so that there are more keywords.
  2. Could get the entire article instead of just the breif descriptions, however this would increase the scraping time considerably.
  3. Get articles from all the sections including Entertainment, Life&Style, Tech&Science etc.

tweetanalyzer's People

Contributors

kushalkadaba 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.