Automatic emotion detection in text streams by analyzing Twitter data

  • Maryam HasanEmail author
  • Elke Rundensteiner
  • Emmanuel Agu
Regular Paper


Techniques to detect the emotions expressed in microblogs and social media posts have a wide range of applications including, detecting psychological disorders such as anxiety or depression in individuals or measuring the public mood of a community. A major challenge for automated emotion detection is that emotions are subjective concepts with fuzzy boundaries and with variations in expression and perception. To address this issue, a dimensional model of affect is utilized to define emotion classes. Further, a soft classification approach is proposed to measure the probability of assigning a message to each emotion class. We develop and evaluate a supervised learning system to automatically classify emotion in text stream messages. Our approach includes two main tasks: an offline training task and an online classification task. The first task creates models to classify emotion in text messages. For the second task, we develop a two-stage framework called EmotexStream to classify live streams of text messages for the real-time emotion tracking. Moreover, we propose an online method to measure public emotion and detect emotion burst moments in live text streams.


Supervised emotion learning Real-time emotion detection Twitter events analysis Public emotion sensing Text stream classification Soft classification 


  1. 1.
    Wang, W., Chen, L., Thirunarayan, K., Sheth, AP.: Harnessing twitter big data for automatic emotion identification. In: 2012 International Conference on Social Computing (SocialCom), pp 587–592. IEEE (2012)Google Scholar
  2. 2.
    De Choudhury, M., Counts, S., Gamon, M.: Not all moods are created equal! exploring human emotional states in social media. In: ICWSM’12 (2012)Google Scholar
  3. 3.
    Wakamiya, S., Belouaer, L., Brosset, D., Lee, R., Kawai, Y., Sumiya, K., Claramunt, C.: Measuring crowd mood in city space through twitter. In: International Symposium on Web and Wireless Geographical Information Systems, pp 37–49. Springer (2015)Google Scholar
  4. 4.
    Choudhury, MD., Gamon, M., Counts,S., Horvitz, E.: Predicting depression via social media. In: ICWSM’13, The AAAI Press (2013)Google Scholar
  5. 5.
    Park, M., Cha, C., Cha, M .: (2012) Depressive moods of users portrayed in twitter. In: Proceedings of the ACM SIGKDD Workshop on Healthcare Informatics, HI-KDDGoogle Scholar
  6. 6.
    Guthier, B., Alharthi, R., Abaalkhail, R., El Saddik A.: Detection and visualization of emotions in an affect-aware city. In: Proceedings of the 1st International Workshop on Emerging Multimedia Applications and Services for Smart Cities, pp 23–28. ACM (2014)Google Scholar
  7. 7.
    Resch, B., Summa, A., Zeile, P., Strube, M.: Citizen-centric urban planning through extracting emotion information from twitter in an interdisciplinary space-time-linguistics algorithm. Urban Plann. 1(2), 114–127 (2016)CrossRefGoogle Scholar
  8. 8.
    Kanhabua, N., Nejdl, W.: (2013) Understanding the diversity of tweets in the time of outbreaks. In: Proceedings of the 22nd international conference on World Wide Web companion, International World Wide Web Conferences Steering Committee, pp. 1335–1342Google Scholar
  9. 9.
    Hasan, M., Agu, E., Rundensteiner, E.: (2014) Using hashtags as labels for supervised learning of emotions in twitter messages. In: Proceedings of the ACM SIGKDD Workshop on Healthcare Informatics, HI-KDDGoogle Scholar
  10. 10.
    Go, A., Bhayani, R., Huang, L.: Twitter sentiment classification using distant supervision. CS224N Project Report, Stanford, pp 1–12 (2009)Google Scholar
  11. 11.
    Pak, A., Paroubek, P.: Twitter as a corpus for sentiment analysis and opinion mining. In: Proceedings of the Seventh conference on International Language Resources and Evaluation (LREC’10), ELRA, Valletta, Malta (2010)Google Scholar
  12. 12.
    Barbosa, L., Feng, J.: Robust sentiment detection on twitter from biased and noisy data. In: Proceedings of the 23rd ACL: Posters, Association for Computational Linguistics, pp 36–44 (2010)Google Scholar
  13. 13.
    Kouloumpis, E., Wilson, T., Moore, J.: Twitter sentiment analysis: The good the bad and the omg! In: ICWSM’11, The AAAI Press (2011)Google Scholar
  14. 14.
    Gunes, H., Schuller, B., Pantic, M., Cowie, R.: Emotion representation, analysis and synthesis in continuous space: A survey. In: 2011 IEEE International Conference on Automatic Face & Gesture Recognition and Workshops (FG 2011), pp. 827–834. IEEE (2011)Google Scholar
  15. 15.
    Wang, X., Wei, F., Liu, X., Zhou, M., Zhang, M.: Topic sentiment analysis in twitter: a graph-based hashtag sentiment classification approach. In: Proceedings of the 20th ACM international conference on Information and knowledge management, pp 1031–1040. ACM (2011)Google Scholar
  16. 16.
    Russell, J.A.: A circumplex model of affect. J. Personal. Soc. Psychol. 39, 1161–1178 (1980)CrossRefGoogle Scholar
  17. 17.
    Hasan, M., Rundensteiner, E., Agu, E.: Emotex: Detecting emotions in twitter messages. In: Proceedings of the Sixth ASE International Conference on Social Computing (SocialCom 2014), Academy of Science and Engineering (ASE), USA (2014)Google Scholar
  18. 18.
    Russell, J.A., Barrett, L.F.: Core affect, prototypical emotional episodes, and other things called emotion: dissecting the elephant. J. Personal. Soc. Psychol. 76(5), 805 (1999)CrossRefGoogle Scholar
  19. 19.
    Ekman, P.: Basic emotions. Handb. Cognit. Emot. 98, 45–60 (1999)Google Scholar
  20. 20.
    Bollen, J., Mao, H., Pepe, A.: Modeling public mood and emotion: Twitter sentiment and socio-economic phenomena. In: ICWSM’11 (2011)Google Scholar
  21. 21.
    Purver, M., Battersby, S.: Experimenting with distant supervision for emotion classification. In: Proceedings of the 13th EACL, Association for Computational Linguistics, pp. 482–491 (2012)Google Scholar
  22. 22.
    Strapparava, C., Mihalcea, R.: Learning to identify emotions in text. In: Proceedings of the 2008 ACM symposium on Applied computing, pp. 1556–1560. ACM (2008)Google Scholar
  23. 23.
    Liu, H., Lieberman, H., Selker, T.: A model of textual affect sensing using real-world knowledge. In: Proceedings of the 8th international conference on Intelligent user interfaces, pp. 125–132. ACM (2003)Google Scholar
  24. 24.
    Calvo, R.A., Mac Kim, S.: Emotions in text: dimensional and categorical models. Computat. Intell. 29(3), 527–543 (2013)MathSciNetCrossRefGoogle Scholar
  25. 25.
    Princeton, U.: (2010) Wordnet.
  26. 26.
    Bradley, M.M., Lang, P.J.: Affective norms for english words (anew): Instruction manual and affective ratings. In: Technical Report Citeseer (1999)Google Scholar
  27. 27.
    Pennebaker, JW., Francis, ME., Booth, RJ.: Linguistic inquiry and word count: Liwc 2001. Mahway: Lawrence Erlbaum Associates p. 71 (2001)Google Scholar
  28. 28.
    rup Nielsen, F.: A new anew: evaluation of a word list for sentiment analysis in microblogs. In: Proceedings of the ESWC2011 Workshop on ’Making Sense of Microposts’: Big things come in small packages, vol. 718, pp. 93–98 (2011)Google Scholar
  29. 29.
    Liu, Y., Zhang, H.H., Wu, Y.: Hard or soft classification? Large-margin unified machines. J. Am. Stat. Assoc. 106(493), 166–177 (2011)MathSciNetCrossRefzbMATHGoogle Scholar
  30. 30.
    Zadrozny, B., Elkan, C.: Transforming classifier scores into accurate multiclass probability estimates. In: Proceedings of the eighth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 694–699. ACM (2002)Google Scholar
  31. 31.
    Platt, J., et al.: Probabilistic outputs for support vector machines and comparisons to regularized likelihood methods. Adv. Large Margin Classif. 10(3), 61–74 (1999)Google Scholar
  32. 32.
    Hasan, M., Rundensteiner, E., Kong, X., Agu, E.: Using social sensing to discover trends in public emotion. In: 2017 IEEE 11th International Conference on Semantic Computing (ICSC), pp. 172–179. IEEE (2017)Google Scholar
  33. 33.
    Branco, P., Torgo, L., Ribeiro, R.P.: A survey of predictive modeling on imbalanced domains. ACM Comput. Surv. (CSUR) 49(2), 31 (2016)CrossRefGoogle Scholar
  34. 34.
    Joachims, T.: Making large-scale SVM learning practical. In: Schölkopf, B., Burges, C.J., Smola, A. (eds.) Advances in Kernel Methods-Support Vector Learning. MIT Press, Cambridge (1999)Google Scholar
  35. 35.
    Ma, C., Prendinger, H., Ishizuka, M.: Emotion estimation and reasoning based on affective textual interaction. In: Affective Computing and Intelligent Interaction, pp. 622–628. Springer (2005)Google Scholar
  36. 36.
    Neviarouskaya, A., Prendinger, H., Ishizuka, M.: Textual affect sensing for sociable and expressive online communication. In: Affective Computing and Intelligent Interaction, pp. 218–229. Springer (2007)Google Scholar
  37. 37.
    Dodds, P.S., Danforth, C.M.: Measuring the happiness of large-scale written expression: songs, blogs, and presidents. J. Happiness Stud. 11(4), 441–456 (2010)CrossRefGoogle Scholar
  38. 38.
    Strapparava, C., Valitutti, A.: Wordnet affect: an affective extension of wordnet. In: Proceedings of 4th International Conference on Language Resources and Evaluation, LREC, vol 4, pp. 1083–1086 (2004)Google Scholar
  39. 39.
    Mohammad, SM.: # emotional tweets. In: Proceedings of the First Joint Conference on Lexical and Computational Semantics, Association for Computational Linguistics, pp. 246–255 (2012)Google Scholar
  40. 40.
    Canales, L., Strapparava, C., Boldrini, E., Martnez-Barco, P.: Exploiting a bootstrapping approach for automatic annotation of emotions in texts. In: 2016 IEEE International Conference on Data Science and Advanced Analytics (DSAA), pp. 726–734. IEEE (2016)Google Scholar
  41. 41.
    Qadir, A., Riloff, E.: Bootstrapped learning of emotion hashtags# hashtags4you. WASSA 2013, 2 (2013)Google Scholar
  42. 42.
    Suttles, J., Ide, N.: Distant supervision for emotion classification with discrete binary values. In: International Conference on Intelligent Text Processing and Computational Linguistics, pp. 121–136. Springer (2013)Google Scholar
  43. 43.
    Agrawal, A., An, A .: Unsupervised emotion detection from text using semantic and syntactic relations. In: Proceedings of the The 2012 IEEE/WIC/ACM International Joint Conferences on Web Intelligence and Intelligent Agent Technology-Volume 01, pp. 346–353. IEEE Computer Society (2012)Google Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  • Maryam Hasan
    • 1
    Email author
  • Elke Rundensteiner
    • 1
  • Emmanuel Agu
    • 1
  1. 1.Computer Science DepartmentWorcester Polytechnic InstituteWorcesterUSA

Personalised recommendations