LogoI’ve been invited to write a few words about a Chrome Extension I’ve made that uses the Semantria API to analyze sentiment on any webpage on-the-fly. It’s a simple extension where, once installed, you’ll be able to highlight any text on any page and extract all the Entities, Themes, Phrases, Topics and the Sentiment Score related to the whole text or for each Entity, Theme, Phrase or Topic found. I’d like to thank Wilson and the Semantria guys for this opportunity.

Building a sentiment analysis extension was a New Year challenge. I was encouraged to begin researching Sentiment Analysis, and how it could be beneficial to my company. In short, I wanted to find the what, the how, and the tools.I started gathering and studying various theses and articles about this subject. I then went about finding the main tools in this area. While I found a lot of them, Semantria was one of the first tools I found and impressed me a lot. It has an easy to use REST API and covered a lot of topics in the field of Machine Learning.

But you can only learn so much by reading and writing reports of a technology. I believe that if you really want to learn a new technology or tool, you must pull up your socks and start coding! I decided to write an extension with three goals in mind: learn the Semantria API, learn how to create Chrome extensions, and share with the world all I’ve learned!

To build it, I had no choice other than using web technologies like CSS, HTML, and JavaScript because all Chrome Extensions are built using them. Not a problem to me though, because I’ve been working with web development since 2003.

As a foundation, I used the well-known JavaScript frameworks, Bootstrap 3 and jQuery. I chose Bootstrap for two main reasons. First and most important, because I have no idea what’s the difference between pixels, layers, colors and all these designer things. Second, it’s simple to use and provides beautiful and ready-to-use interface components.

I used jQuery because I believe it’s the best tool to simplify DOM manipulation. To request Sentiment Analysis from Semantria, I used Semantria’s JavaScript SDK. I thought building this extension would have been a long-term project, but it only took me three days to mix it up and get the first version ready to go. All further improvements were made over two more weeks, working together with Wilson.

This extension is under a free license (GPL v3) and you can get the source code on GitHub. It is also available on the Chrome Store. Feel free to send me your feedback and I hope you like it!


Marlon Carvalho is a passionate developer and employee of Serpro, a Brazilian government company. At this point, he’s focused on researching about Sentiment Analysis, Mobile Development, and Big Data. If you want to know more about Marlon, follow him on Twitter (@marlonscarvalho) or at his blog (Portuguese only, sorry!).