Emotion Detection for Health and Well-being in Short Messaging Systems

to


Introduction
The third Sustainable Development Goal (SDG 3) aims to achieve universal health coverage and promote well-being for all, with a specific target to eliminate the epidemics of communicable diseases, including AIDS, tuberculosis, malaria, and others, by 2030.It is line with this that this study seeks to explore technological ways to achieving this goal.Emotion is a principal part of human existence.It is an individual's internal state of being and an automatic physiological reaction to an object or times, the World Wide Web has emerged into a smart-mobile industry which allows humans to communicate with each other through various social media sites (such as Facebook, Twitter, and Instagram), video sharing sites (such as YouTube) or blog.Humans widely interact with computer via texts while multimodal human-computer interaction is also denoted to be appealing.It cannot be denied that the short message service (SMS) remains one of the earliest text-based mode of interaction, even before the advent of the various social media platforms.However, due to the influence of this new media on the society, most of the people like to share their opinion or express their emotions via any of the social media platforms.Hence, various studies on emotion detection and control have been carried out on the aforementioned social media outlets.
In line with the foregoing, it is plausible to state that much emphasis has not been placed on the SMS which is one of the common text-based modes of human interaction.Thus, efforts should be made to carry out a text-based emotion analysis on this mode of interaction.Emotion recognition, particularly text-based, remains a viable path for modern scholars and researchers, as its importance tilts towards humans need for communication and socialization.Emotion recognition (also known as: Artificial Emotional Intelligence) is an affective computing whereby the development of systems utilizes the process of detecting, interpreting, and predicting human emotional state such as anger, happiness, sadness, etc.In the view of Shivhare and Khethawat (2012), detecting a person's emotional state by analyzing a text document written by him or her may appear difficult, but it is often necessary because textual expressions are often not only direct expressions of emotion words, but also result from the interpretation of the meaning of concepts and the interaction of concepts described in the text document.A text-based emotion control system is imperative.It is a system that analyzes a text and detects emotions from the text by finding relations within the text and the emotions that lies within it using some emotional keywords, from nouns, verbs and adjectives.Thus, if a negative sentiment is presented in a text, the system detects it, and relays the result to the user.The system provides this text-based emotion control from a large number of the English lexicons.It is intended to serve as a viable way to protect humans from reading unprepared negative text-based messages which may hold certain dangerous health reactions.Over the years, the health issues have been on the high side due to the effect of reading text messages with negative emotions in them.To show the prevalence of the health issues caused by the reading text messages, Shalaby et al. (2022) demonstrated Text2quit and Quit4baby, two texting service programs to help people cease from smoking addiction; and Text4Mood and Text4Support, two other mobile text messaging programs to help people with mood disorders and other mental health conditions, including alcohol use disorder.Health issues such as heart attack, high blood pressure, hypertension, stroke and even bowel disorder can occur due to negative messages as noted by Ogbuju et al (2021) which also demonstrated that having a system that filters and block negative emotions in text messages from getting to the user will be of great help in reducing the impact of these health matters on our communities.
While humans are generally more adept at identifying emotions in text documents or blogs, this process can be time-consuming as it requires a thorough analysis of the text to determine the emotions being conveyed (Adiyanto, et al 2021).Therefore, there is a need for machine learning techniques to automate this task.Various machine learning approaches have been utilized over time to detect emotions in textual data.Shivhare and Khethawat (2012) conducted a knowledge-based survey on emotion detection using textual data and introduced a new architecture for recognizing emotions in text documents.This proposed architecture consists of two primary components: an emotion ontology and an emotion detector algorithm.By taking a text document and the emotion ontology as inputs, the emotion detector system can identify one of six emotion classes, namely love, joy, anger, sadness, fear, and surprise, as its output.Jain, Kumar, and Fernandes (2017) developed a hybrid framework to automatically detect emotions in multilingual text data.Their model utilized natural language processing techniques to extract emotions from texts and classify them according to Ekman's emotion models (anger, disgust, happiness, sadness, fear, and surprise) using SVM and NB.This approach outperformed other methods, achieving an accuracy of 72.1% in a multilingual scenario.Byun and Lee (2010) introduced a system that can automatically generate gesture animations from SMS and stylize them according to the emotion being conveyed.One of the key features of this system is its real-time algorithm, which enables the combination of gestures with emotions while guaranteeing a performance of 15 or more frames per second.Initially, the system extracts words that express feelings and their corresponding gestures statistically, and then employs Laban Movement Analysis theory to combine the gestures with the emotions.
Another related work produced the EmoHeart, a lexical rule-based system developed by Neviarouskaya et al. (2010) which detects emotions from text and visualizes them in a virtual environment.The system first searches for emotional abbreviations and emoticons; if none are found, it processes the sentence on various levels (such as word, phrase, and sentence levels) to create an emotional vector of the sentence, where each element represents the intensity of an emotional class.They achieved an average accuracy of 75% when testing the system on a manually annotated dataset.However, their method has some limitations, such as the inability to handle negation in sentences and the reliance on an affective database where emotions and their intensities were assigned manually to each word, making it challenging to extend their approach to classify additional emotions.Danisman and Alpkocak (2008) investigated the automatic classification of emotions in text using the International Survey on Emotion Antecedents and Reactions (ISEAR dataset).They utilized the Vector Space Model (VSM) to classify 801 news headlines from the "Affective Task" in the SemEval 2007 workshop, which focuses on the classification of emotions and valences in text.In their study, they compared the findings of VSM classification with ConceptNet and advanced text-based classifiers like Naive Bayes and Support Vector Machines (SVM).The results indicated that VSM outperformed the other classifiers in detecting emotions in texts.
According to Ho and Cao (2012), emotions are connected to human mental states triggered by emotional events.They proposed a Hidden Markov Model (HMM) that applies this concept by considering each sentence as comprising multiple sub-ideas, where each idea represents an event that leads to a particular mental state.The system analyzes the sequence of events within a sentence to determine the most probable emotion conveyed by the text.However, the system's performance was limited due to the lack of consideration of the sentence's semantic and syntactic structures, making it non-context-sensitive.When tested on the ISEAR dataset, the system achieved an F-score of 35%, with the best precision being 47%.Anusha and Sandhya (2015) proposed a hybrid approach that combined rule-based and learningbased methods.Their approach involved defining rules based on the syntactic and semantic features of text extracted through Support Vector Machine (SVM).Natural Language Processing techniques were employed to enhance the performance of learning-based classifiers, such as Naïve Bayes (Chen et al., 2020).The Ekman emotional model and ISEAR database were utilized in their study.
The reviewed literature reveals that different techniques have been employed for detecting emotions from text using machine learning.However, a common trend is the use of the ISEAR dataset in many of the models and projects developed for predicting emotions in text.Additionally, the literature has mainly concentrated on detecting emotions from blogs, websites, and news headlines.
The aim of this study is to develop a text-based emotion control model for short messaging services (SMS).To achieve this aim, the study designed an emotion framework that detects positive and negative messages, built a machine learning model that detects positive and negative messages and then returns feedback to the user or receiver of the text and evaluated the performance of the model.The identification of human emotions holds great importance in fields such as security and healthcare.It allows for the detection of human sentiments without the need for direct inquiry.This study therefore proposes a model for controlling the emotions of users by providing them with the emotional content of SMS messages before they are read.This would enable the blocking of text messages that contain negative emotions, preventing health issues such as high blood pressure and bowel disorders, which can be caused by abruptly reading emotionally charged messages.While there has been extensive research in the area of emotion detection using speech and facial recognition, little attention has been given to text-based emotion detection, specifically through SMS.This research aims to fill that gap by developing a machine learning model that detects emotions in SMS messages and relays the results to the message's recipient.The technical aspects of the project involve techniques such as sentiment analysis and opinion mining using lexicon-based approaches and machine learning algorithms to model the sentiments of texts.These techniques have been applied in previous works by Ogbuju et al (2022) to classify social protest messages in Emeka et al (2023) to review approaches for the control of fake news.The contribution of this study its potential to improve the well-being of individuals by providing them with the ability to control the emotional impact of textual messages.

Method
The system is designed to mitigate the negative effects of text messages on users by using a textbased emotion control system.Typically, SMS messages are delivered directly to the recipient without being filtered for positive or negative content.The message is transmitted from the sending device to the nearest cell tower, which forwards it to a Short Message Service Center (SMSC).The SMSC then relays the message to a cell tower near the receiving device, which then passes the message to the recipient.However, with the text emotion system in place, the message is intercepted at the receiving device, and if positive emotion is detected, it is delivered to the user.If negative emotion is detected, the message is blocked, and a notification is sent to the user to inform them that a message with negative emotion was received but has been blocked.
The main components of the system include an emotion detector and classification models which processes an input message into different emotion classes as output with which the message access is determined.The process framework is shown in Fig 1.The system consists of two major parts, the application interface development using Tkinter Python (Yadav & Raheman, 2023) and the detection/classification model development using Python libraries (Herath et al., 2020) such as Pandas (Marins et al., 2021), Numpy (Khamparia et al., 2020), Sci-kit Learn (Christ et al., 2018), Matplotlib (Imtyaz et al., 2020), and Seaborn (Nasiboglu & Nasibov, 2022).As shown in the process flow in Figure 1, six (6) functional modules, namely text input, text-preprocessing, feature extraction, emotion detection, classification and result display are followed in the model development.The Agile software development process was adopted for the application system, allowing for flexible changes and improvements to the application during the development process.
The system's user interface design consists of three distinct pages: the homepage, message received page, and message blocked page (Adebowale et al., 2019).The homepage enables the user to input text and send it via a button (Xu et al., 2015).The message received page displays the message ISSN 1693-6590 Vol. 21, No. 2, 2023, pp. 100-10 104 8 to the recipient for reading (Oeldorf-Hirsch & Sundar, 2015).In contrast, the message blocked page shows a notification that the text has been blocked if the provided text contains negative emotions, preventing the recipient from reading it (Wu et al., 2020).The screenshot of the experimental dataset used in building the model is shown in Fig 2 .It is a collection of tweets which had been labeled with the different emotions they convey.

Results and Discussion
The Logistic Regression algorithm gave the highest accuracy of 98.4% among others as shown in Table 1.This was used to build the detection system.The system's Graphical User Interface was designed using HTML and CSS.It provides the environment that makes the user's interaction with the system simple and efficient for accomplishing user goals (Cernea & Kerren, 2015;Stephens-Fripp, 2016).It also shows how the user performs certain interactions and the usability of the interface design.It serves as the screen of the sender of a text message (Fig 3).

Fig 3. Text Message Interface
When a user inputs a message with a positive emotion and clicks on the send button, the message is analysed analysed by the Text Based Emotion Detection System to give an output.The output displayed would be "Message Received" and the sent message would be allowed to be displayed.This is because this message will have no negative result or effect on the reader of the given message.This is shown in Fig 4.  While previous works reviewed in this study concentrate on detecting emotions, this work had extended this feature to an application that would block negative emotions from getting to recipient.This work significantly impacts the field of health and well-being by addressing the health risks associated with negative emotions in text messages.It presents an innovative solution through machine learning and real-time emotion detection in SMS, with potential applications in improving users' emotional well-being and overall health.However, the study is subject to some limitations because the datasets used are labeled by individuals, and people may have varying interpretations and readings of emotions.Also, sarcasm in text can make it difficult to interpret emotions accurately since it may not be expressed directly.Again, word ambiguity can also pose a challenge in assigning keywords to a particular emotion class since a word can have different meanings in different contexts.In the current system, the model may be unable to recognize emotions in the absence of emotion keywords, which can lead to underestimation of emotions conveyed in a text.

Conclusion
The detection of emotions from textual data is crucial in addressing health concerns.To achieve this, a Text Based Emotion System was developed, which analyzes specific keywords in the text to determine its emotional content.The system developed in this project comprises two main components: a user interface designed using Python and a machine learning model that serves as the backend.The interface enables seamless interaction between the user and the model, while the machine learning model achieves an accuracy of 98.4% using Logistic Regression, making it the best option for emotion detection in textual data.This system can greatly reduce negative health outcomes resulting from exposure to negative emotions.Individuals with conditions such as bowel disorders and heart issues, which are exacerbated by negative messages, can benefit from this detection system.Future research should focus on improving the system to provide positive feedback to users when negative emotions are detected, as well as extending its application to social media and other contexts.
Ogbuju (Emotion Detection for Health and Well-being in Short Messaging Systems)

Table 1 .
Model Evaluation