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.
- Register on Twitter developer platform and create a new application.
- In “Keys and access token” section, note consumer key and consumer secret. We will use it to authenticate our requests later.
- Install nodejs, if not done already. There are plenty of guides online on installation part.
- Install express (command: sudo npm install express -g)
- Create a new folder and initialize express module by filling relevant information (command: express)
- 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:
- 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