Analysing emojis can uncover meaning and sentiment in ways regular text analytics cannot. So this was the main idea to introduce sentiment data into the Emoji-Heatmapper app. LokLak Search API has features such as classification and categorization of tweets. The emotions, for instance, can be joy, anticipation, sad etc.
So, in the Emoji-heatmapper app, I am displaying the occurrence of emojis on the map according to the location traced and also the sentiment related to the emoji i.e., search query as follows:
How to get the sentiment data:
One should simply enter the emoji into the search box for the results. The following code shows part of the LokLak Search API results (JSONObject):
I am using the above field name ”classifier_emotion” to display the results.
Till here getting the data relevant to query part is done. Next, the classifier_emotion of each tweet containing the query is collected into an array and sorted to get a unique list.
Loading the Sentiment data onto the Screen
When the query has a single emotion, or if multiple emotions or no emotions. These use cases/situations are displayed as follows:
Fig: Single Emotion
Fig: Multiple Emotions
Fig: No Emotions data
The code which creates the data dynamically on the output screen is as follows:
The Emoji-Heatmapper app displays the sentiment data of the query being searched for which populates data dynamically using LokLak Search API.
- Emoji-Heatmapper App, try it out here: http://apps.loklak.org/emojiHeatmapper/
- Source Code: https://github.com/fossasia/apps.loklak.org/tree/master/emojiHeatmapper
- Search API: http://api.loklak.org/