Detecting emotional concepts, such as sarcasm, within a text is not an easy task for an artificial intelligence (AI) algorithm. For instance, consider the sentence below. Without the emoji present it’s not clear what the author was feeling. The author could have been sad because of a lack of a special someone in his life or he could have been happy due to a great experience with a close friend.
The emoji disambiguates the sentence and makes it clear that the author was in a happy loving mood. Our AI algorithm can make use of this way that authors self-annotate the emotional content of text.
The core idea is that if our AI algorithm can understand what emoji was part of the sentence, then it has a good understanding of the emotional content of the text. We can then use this emotional understanding for many other difficult and important tasks such as detecting hate speech and online bullying.
Applications in industry and for researchers
It can also be relevant for many applications in industry. The classic use case is companies wanting to make sense of what their customers are saying about them. But there are many other use cases now that interaction through language is becoming an important part of many technology products. For instance, all chatbot services (Siri, Alexa and many others) might benefit from having a nuanced understanding of emotional content in text.
I personally experienced the limitations of the former methods for analysing emotions in text when I wanted to examine trends in racism on social media with colleagues at MIT. We quickly found that the existing methods could not capture all of the nuances required to properly detect hate speech, as they mostly focused on marking a text as either negative or positive. Moreover, these existing methods had issues with the sarcasm and slang that often occurs on social media.
Our DeepMoji algorithm, however, does not suffer from this shortcoming. For instance, the algorithm can capture slang such as ‘this is the shit’ being a positive statement. Similarly, it can understand the context of each word, thereby learning that despite a sentence containing the generally positive word ‘love’, it may not be positive. We also make an online demo available here, for those interested in testing the capabilities of our algorithm.
How does the AI algorithm learn?
We extracted a dataset of 55B tweets from Twitter, containing short messages about anything and everything. These tweets were then filtered into a dataset of 1.2B English tweets that contain emojis. For each of these tweets, the algorithm is trained to predict the emoji that was part of the original tweet.
Once the algorithm has learned to map text to emojis, we can then transfer this knowledge to a specific task such as racism detection by adding just a little bit of data on that specific task. With this approach, we beat the best existing algorithms across benchmarks for sentiment, emotion, sarcasm and offensive language detection. Our method also works for texts coming from sources that are very different from social media and never contain a single emoji or hashtag. Hopefully, researchers and practitioners in industry can use it for a lot of other interesting purposes as well. That’s why we make our algorithm freely available for anyone to use.
Understanding emoji usage
Another interesting part of the research project is that it can give us insight into how we use emojis. Our AI algorithm learns to group emojis into overall categories associated with, for example, negativity, positivity or love. Similarly, the algorithm learns to differentiate within these categories, mapping sad emojis in one subcategory of negativity, annoyed in another subcategory and angry in a third one as seen below.
Future of emotion analysis
This research is only a small step towards sophisticated emotion analysis. In large part, our project builds on the way that people express their emotions, but there might sometimes be a discrepancy between what people say and how they feel. We believe that the next big step is to better understand this discrepancy. For that, we’d like your help.
In collaboration with social scientists and psychologists we have setup a small website to gather the needed data, which we will then share with the research community. You can help us improve the potential impact of our emotional AI algorithm and our understanding of emotions in general by simply telling us how you felt when writing your tweets on Twitter. Our project is also a SciStarter Affiliate so your contributions are tracked and credited within your SciStarter dashboard. You can find more citizen science projects to help researchers on SciStarter’s Project Finder.
Explore DeepMoji here.
About the author:
Bjarke Felbo is a graduate student at the Massachusetts Institute of Technology (MIT) working on problems that lie in the intersection of statistics, machine learning and computational social science. He is one of three Marvin Minsky Fellows supported for their promising research within artificial intelligence. Major media outlets such as BBC and Newsweek have covered his work.