Elsevier

Computers in Human Behavior

Volume 93, April 2019, Pages 309-317
Computers in Human Behavior

Full length article
Understanding Emotions in Text Using Deep Learning and Big Data

https://doi.org/10.1016/j.chb.2018.12.029Get rights and content

Highlights

  • Emotion Detection in text finds several practical applications such as modulation of responses for real-world chat-bot.

  • Combining Sentiment and Semantic information in a text improves emotion detection system.

  • Our approach learns diverse ways of expressing emotions and significantly outperforms methods described in literature.

Abstract

Big Data and Deep Learning algorithms combined with enormous computing power have paved ways for significant technological advancements. Technology is evolving to anticipate, understand and address our unmet needs. However, to fully meet human needs, machines or computers must deeply understand human behavior including emotions. Emotions are physiological states generated in humans as a reaction to internal or external events. They are complex and studied across numerous fields including computer science. As humans, on reading “Why don't you ever text me!”, we can either interpret it as a sad or an angry emotion and the same ambiguity exists for machines as well. Lack of facial expressions and voice modulations make detecting emotions in text a challenging problem. However, in today's online world, humans are increasingly communicating using text messaging applications and digital agents. Hence, it is imperative for machines to understand emotions in textual dialogue to provide emotionally aware responses to users. In this paper, we propose a novel Deep Learning based approach to detect emotions - Happy, Sad and Angry in textual dialogues. The essence of our approach lies in combining both semantic and sentiment based representations for more accurate emotion detection. We use semi-automated techniques to gather large scale training data with diverse ways of expressing emotions to train our model. Evaluation of our approach on real world dialogue datasets reveals that it significantly outperforms traditional Machine Learning baselines as well as other off-the-shelf Deep Learning models.

Introduction

Technology is continuously evolving to amplify human ingenuity, to make our day to day life simpler and, to anticipate and address our unmet needs. In order to anticipate our needs, it is essential for machines or computers to be able to deeply understand human behavior. Human behavior is very complex. Culture, social norms, faith, language among many other things, play a role in defining human behavior. In particular, understanding and expressing emotion is a key element of human behavior. Emotions must be deeply understood by machines and computers, to be able to anticipate human needs.

Emotions such as happiness, anger, sadness etc. are physiological states that humans routinely experience. In the field of cognitive computing, where we develop technologies to mimic functioning of the human brain, understanding emotions is an important area of research (Thilmany, 2007). With growing prominence of messaging platforms like WhatsApp and Twitter, there is an increased interaction using textual dialogues. There are several digital agents and chat bots on these messaging platforms and are currently being used by a large number of online users. The success of these agents depends on their ability to modulate responses based on user emotions for which it is imperative to be able to detect emotions in textual dialogues and avoid responding inappropriately (Miner et al., Linos).

Furthermore, ability of machines or computers to understand emotions is critical for success of several other applications as well. For instance, in the domain of customer service, social media platforms like Twitter are gaining prominence where customers expect quick responses. In case of heavy flow of tweets, turn-around time for responses increase. Prioritizing tweets according to their emotional content and responding to them in that order will result in increased customer satisfaction. For example, responding to an angry tweet prior to a basic inquiry. Furthermore, in this era of text messaging, users are constantly texting and may send inappropriately angry messages to others. If emotion detection is implemented, in such cases, the application can take appropriate action such as popping up a warning to the user before sending a message. Emotion detection also finds social applications such as flagging content representing bullying, depression etc. from Twitter streams or online fora. Thus, emotion detection in textual dialogue finds several applications in today's online world.

Emotions have been studied by researchers (Hochschild, 2002; Lane et al., 1996; Plutchik, 1994) in the fields of psychology, sociology, medicine, computer science etc. for the past several years. Some of the prominent work in understanding and categorizing emotions include Ekman's six class categorization (Ekman) and Plutchik's “Wheel of Emotion” which suggested eight primary bipolar emotions (Plutchik & Kellerman, 1986). Given the vast nature of study in this field, there is naturally no broader consensus on the granularity of emotion classes. Hence, as a first-step, we restricted our current study to the top three frequently observed emotions in our user logs – Happy, Sad and Angry.

Problem Definition

In a textual dialogue, given the user utterance along with its context, classify the emotion of user utterance as one of Happy, Sad, Angry or Others.

Understanding emotions in textual conversations can be a challenging Problem in absence of facial expressions and voice modulations. Fig. 1 provides an example where it is difficult, even as a human, to detect the emotion of user utterance solely on the basis of text of the conversation. The emotion of the user whose messages are on the left, could be interpreted as angry or sad. The challenge of understanding emotions is further compounded by difficulty in understanding context, sarcasm, class size imbalance, natural language ambiguity and rapidly growing Internet slang. However, big data and powerful deep learning algorithms have paved way for us to attack this problem statement.

In this paper, we propose an end-to-end trainable deep learning model, called “Sentiment and Semantic Based Emotion Detector (SS-BED)” for detecting emotions in textual dialogues. The essence of our approach lies in leveraging both the sentiment and semantic representations of user utterance for accurate emotion detection. The motivation behind combining sentiment and semantic representations can be understood from the following example. Let's consider the utterance “On road again … miss my amazing partner though!”. This utterance contains a negative sentiment word ‘miss’ as well as a positive sentiment word ‘amazing’ but the overall emotion of the utterance is Sad. By combining the sentiment of different words in the utterance with semantic understanding of the sentence, we can detect the emotion in this case. Hence, we intuitively feel combining both sentiment and semantic features helps in improving classification of emotions under such scenarios.

Given a user utterance, SS-BED takes the individual sentiment and semantic representations of their input words and combines them into a unified representation for the entire utterance which is used for predicting the emotion. We evaluate SS-BED on real world textual dialogues and it outperforms traditional Machine Learning approaches and other Deep Learning approaches. The main contributions of our paper are as follows:

  • We propose a novel approach towards understanding emotions in textual conversations, using a deep-learning system called SS-BED.

  • We evaluate various Deep Learning techniques and embeddings, along with Machine learning algorithms (such as Support Vector Machines (SVM), Decision Trees, Naive Bayes), on real world textual conversations and compare their effectiveness for the task of understanding emotions.

Practical Application: Our current research is in the context of an online chat-bot, designed for informal conversations with users. In this scenario, we notice that users often express a variety of emotions such as being nervous about exams, excited about a new job, feeling sad about a break-up, etc. In such cases, the boundaries between computers and humans blur, and users expect computers to deeply understand human behavior including emotions. Understanding these emotions and providing an emotionally aware response not only creates a deeper and sustained engagement with users but takes us a step closer to deeply understanding humans and anticipating their psychological needs.

The rest of the paper is organized as follows: Section 2 provides a summary of related work. Section 3 describes our approach (SS-BED) in detail. Our experimental setup is discussed in Section 4 and our results are in Section 5. Finally, Section 6 concludes the paper, followed by future direction for our work.

Section snippets

Related work

A lot of work has happened in the space of image based emotion recognition (Wang et al., 2018), (Zhang et al., 2016). However, classifying textual dialogues based on emotions is relatively new research area. Emotion-detection algorithms can be largely bucketized into following two categories:

  • (a)

    Hand-crafted Feature Engineering Based Approaches: - Many methods exploit the usage of keywords in a sentence with explicit emotional/affective value (Balahur et al., 2011; Chaumartin, 2007; Kozareva et

Our approach

We model the task of understanding emotions as a multi-class classification Problem where given a user utterance, the model outputs probabilities of it belonging to four output classes - Happy, Sad, Angry and Others. The architecture of our proposed SS-BED model is shown in Fig. 2. Our model uses LSTMs (Hochreiter and Schmidhuber, 1735), which are effective in processing sequential information. The input user utterance is fed into two LSTM layers using two different word embedding matrices. One

Experimental setup

In this section, we describe details of evaluation dataset used to compare various techniques and baseline methods used for comparison.

Results

A summary of results from various techniques on the dataset described in Section 4.1 is presented in Table 6. SS-BED gives the best performance on F1 score for each emotion class as well as on Macro and Micro F1, as can be seen more clearly from Fig. 3. The performance of SS-BED over all other models is particularly significant (p < 0.005) as measured by McNemar's test (McNemar, 1969). Our results thus indicate that combining sentiment and semantic features in SS-BED outperforms individual

Conclusion

In this paper, we discuss Problem of understanding emotions in text by machines. To be able to anticipate human needs, emotions must be deeply understood by machines and computers, as understanding and expressing emotion is a key element of human behavior. Detecting emotions helps in modulation and regulation of responses for real-world chat-bot and other textual-dialogue based applications. For this problem, we harness the power of deep learning and big data and propose a Deep Learning based

Future work

As part of our future work, we plan to extend this approach to detect more emotional classes such as Surprise, Fear, Disgust etc. Currently, our model is limited by the fact that it does not train on the context of the dialogue. We plan to train models that also take the dialogue context into account besides the current user utterance.

References (63)

  • S.-H. Wang et al.

    Intelligent facial emotion recognition based on stationary wavelet entropy and jaya algorithm

    Neurocomputing

    (2018)
  • M. Abdul-Mageed et al.

    Emonet: Fine-grained emotion detection with gated recurrent neural networks

  • A. Agrawal et al.

    Unsupervised emotion detection from text using semantic and syntactic relations

  • C.O. Alm et al.

    Emotions from text: Machine learning for text-based emotion prediction

  • R. C. Balabantaray, M. Mohammad, N. Sharma, Multi-class twitter emotion classification: A new approach, International...
  • A. Balahur et al.

    Detecting implicit expressions of sentiment in text based on commonsense knowledge

  • L. Canales, P. Martínez-Barco, Emotion detection from text: A survey, processing in the 5th information systems...
  • F.-R. Chaumartin

    Upar7: A knowledge-based system for headline sentiment tagging

  • V. Chernykh, G. Sterling, P. Prihodko, Emotion recognition from speech with recurrent neural networks, arXiv preprint...
  • C. Cortes, V. Vapnik, Support-vector networks, Machine Learning Vol. 20, pages...
  • P. R. Dachapally, Facial emotion detection using convolutional neural networks and representational autoencoder units,...
  • T. Danisman et al.

    Emotion classification of audio signals using ensemble of support vector machines

  • D. Davidov et al.

    Enhanced sentiment learning using twitter hashtags and smileys

  • P. Ekman, An argument for basic emotions, Cognition & Emotion Vol. 6, pages...
  • A. Esuli et al.

    Sentiwordnet: A high-coverage lexical resource for opinion mining

    Evaluation

    (2007)
  • B. Felbo et al.
  • J. Friedman et al.

    The elements of statistical learning

    (2001)
  • I. Goodfellow et al.

    Deep learning

    (2016)
  • M. Hasan et al.

    Using hashtags as labels for supervised learning of emotions in twitter messages

  • M. Hasan, E. Rundensteiner, E. Agu, Emotex: Detecting emotions in twitter...
  • S. Hochreiter, J. Schmidhuber, Long short-term memory, Neural Computation Vol. 9, pages...
  • A.R. Hochschild

    The sociology of emotion as a way of seeing

  • I.T. Jolliffe

    Principal component analysis and factor analysis

  • A. Joulin, E. Grave, P. Bojanowski, T. Mikolov, Bag of tricks for efficient text classification, arXiv preprint...
  • Y. Kim, Convolutional neural networks for sentence classification, arXiv preprint...
  • M. Köper et al.
  • Z. Kozareva et al.

    Ua-zbsa: A headline emotion classification through web information

  • A. Krizhevsky et al.

    Imagenet classification with deep convolutional neural networks

  • F. Kunneman et al.

    The (un) predictability of emotional hashtags in twitter

  • R.D. Lane et al.

    Impaired verbal and nonverbal emotion recognition in alexithymia

    Psychosomatic Medicine

    (1996)
  • N. Liang et al.

    TRSDL: Tag-aware recommender system based on deep learning–intelligent computing systems

    Applied Sciences

    (2018)
  • Cited by (278)

    View all citing articles on Scopus
    View full text