A beginner’s guide to twitter brand sentiment analyser

download (38)

In this article, we will look at how to build a basic brand sentiment analyser.

We will be building an application which will fetch running stream from twitter filtered for specified brands, try to categorise the emotion in postive or negative bucket, and compare total sentiments summary across brands.

This application will be built in nodejs, using sentiment module to analyze the emotion behind the post.

Setup:

  1. Register on Twitter developer platform and create a new application.
  2. In “Keys and access token” section, note consumer key and consumer secret. We will use it to authenticate our requests later.
  3. Install nodejs, if not done already. There are plenty of guides online on installation part.
  4. Install express (command: sudo npm install express -g)
  5. Create a new folder and initialize express module by filling relevant information (command: express)
  6. Step 5 should create a package.json file in your work directory, Open it in your favourite editor and add following dependencies: debug, sentiment, twitter. Your file should look like this: 
  7. Run npm install to install dependencies.

Now lets dive into coding part

Here is gist of code that I came up with while building this application

Feel free to reach me out for any query related to above.

Image credits: Animal NewYork