# Context-Based Emotion Predictor: A Decision- Making Framework for Mobile Data

Authors: Zahid Anwar; Rashid Jahangir; Muhammad Asif Nauman; Roobaea Alroobaea; Sabah M. Alzahrani; Ihsan Ali
Journal: Mobile Information Systems
 (2022)

---

## Abstract

The proliferation of big data for web-enabled technologies allows users to publish their views, suggestions, sentiments, emotions, and opinionative content about several real-world entities. These available opinionative texts have greater importance to those who are inquisitive about their desired entities, but it becomes an arduous task to capture such a massive volume of user-generated content. Emotions are an inseparable part of communication, which is articulated in multiple ways and can be used for making better decisions to reshape business strategies. Emotion detection is a subdiscipline at the crossroads of text mining and information retrieval. Context is a common phenomenon in emotions and is inherently hard to capture not only for the machine but even for a human. This study proposes a decision-making framework for efficient emotion detection of mobile reviews. An unsupervised lexicon-based algorithm has been developed to tackle the problem of emotion prediction. Dictionaries and corpora are used as backend resources in the semantic orientation of emotion words, whereas the major contribution is to cope with contextualized emotion detection. The proposed framework outperformed the existing emotion detection systems by achieving 86% accuracy over mobile reviews.


---

## Body

## 1. Introduction

With the development of mobile Internet technology, the number of personal mobile devices is increasing rapidly. This rapid increase changes the conversation trend as people from different geographical areas are shifting to the Internet for collaboration. This tremendous growth gives birth to thousands of Internet applications for communication to allow users and organizations to generate suggestions, ideas, and expressions to share their views about different real-world entities and objects. These channels produce a substantial amount of data for mobile products according to the features and uses of different mobile devices.Companies are always curious about the popularity of their products and the current market trends regarding their products and services. Before this survey and manual analysis were taken to evaluate market trends, now web-enabled technology can give a fast and novel way of analysis for user suggestions, feelings, and ascertaining tendencies in public sentiment. By evaluating this data, we can monitor suspicious entities, optimize recommendation systems, and collect opinions from the masses early in the timeline of large-scale data. Users often trust others’ recommendations or reviews, either from online purchase websites or review sites, to finalize their purchasing decisions. However, reading all the reviews is time-consuming and deceptive for the user to extract meaningful information because of the abstruseness of text and symbols, spam reviews, misleading multidomain context, slang, sarcastic tags, and emoticons used in the text.Therefore, researchers are looking to develop an automatic system to classify, identify, and summarize sentiments and opinions for fine-grained sentiment analysis. Sentiment analysis (SA) is a computational study and subfield of data mining and Natural Language Processing (NLP) problems. In sentiment analysis, machine learning (ML) is the backbone for artificial intelligence (AI) and NLP, and its role is to predict and orientate the sentiment. ML systems perform many tasks such as part-of-speech (POS) tagging, lemmatization, stemming, co-reference, spam detection, Word Sense Disambiguation (WSD) parsing, and dataset popularity detection [1–3]. The primary goal of SA is to detect public expression towards the targeted entities. Nowadays, social networking and microblogging are convenient ways for people to express their emotions about certain topics. These emotions are not applied only to one thing, but they are applied to the stock market, product analysis, news articles, political reviews, and much more topic analysis.This field of study provides remarkable facilities to the user as well as the organization to reshape business strategies according to public trends. Some novel innovations change the span of public websites, especially the cellular network, facilitating billions of users by providing real-time conversation applications. Therefore, by using these conversations, the semantic analysis achieves its desired goal. Sentiment analysis is a statistically important application for the considerable volume of social media data that reduces human effort and extracts the opinion for policy making, decision making, and extracting meaningful information for any purpose. All these turn into a new opportunity for the complementary data stream for improving opinion, emotion detection, transfer learning, and building text-based resource information. That is worthwhile for social media monitoring and characterizing the overall feeling and focusing of any person towards entities.In the past decade, different domains of study like social science, artificial intelligence, and psychology have all tried to explore the emotional impact of everyday situations that is in the form of human gestures, expressions, and posture for text and speech [4, 5]. In addition to this, an artificial intelligent agent perceives emotions from gestures and facial expressions and has the ability to recognize and express human-like emotions [6]. Emotion extraction aims to comprehend the way people express their emotions in text. Many attempts have already been made previously to extract the different dimensions of emotion in the text by using different datasets like Twitter, data on politics, medical, current affairs issues, and any incident. Here in this work, the input is a real-time conversation regarding any mobile launching ceremony or discussion about the features and drawbacks of a mobile product on microblogging sites. In the past, many attempts were made for the classification of public mood, but the dramatic change in communication created a new challenge for researchers The use of context in text communication is one of the challenges in how an individual or a group uses emotions in overall communication in any entity session or individual session of the user in all places. Furthermore, identifying the relevant context of natural language increases the judgment of a conversation in a way that enhances the specific topic and the interaction of any event/entity. Natural language is based on the syntactic, not the semantic level of analysis; that is, the disambiguation of a homogeneous context. How people feel and articulate plays a crucial role while doing social media communication. The previous artificial intelligent agent also lacked the ability to articulate and learn the emotions of text, which is based on context. It’s important to care about the reactions of people. When we analyze a large review instead of focusing on one person, we can recognize some effective information that is only due to context analysis. For sentiment analysis, three approaches are used: supervised, semi-supervised, and unsupervised [7, 8]. To handle the contextualized emotion detection, an unsupervised lexicon-based algorithm was developed as supervised and semi-supervised machine learning algorithms perform better for informal text, which is not suitable for informal communication on social media. In addition, dictionaries and corpora were used as backend resources in the semantic orientation of emotion words.This study developed a real time conversion chat application for product feedback and captured the accurate context-based emotion prediction. Moreover, this study proposed a decision-making framework for efficient emotion detection of mobile reviews. An unsupervised lexicon-based algorithm was developed to tackle the problem of emotion prediction. To achieve this, dictionaries and corpora were used as backend resources in the semantic orientation of emotion words. In addition, the major contribution is to cope with contextualized emotion detection.The rest of the paper is structured as follows: previous background studies anda basic overview of sentiment analysis methods are reviewed in Section2. We proposed a method to compute sentiment scores of context-based emotions in Section 3. The evaluation results of our proposed system are concluded in Section 4. Conclusions and future directions for context-based emotion detection are presented in Section 5.


## 2. Literature Survey

The development of Internet of things (IoT) technology and web digital devices like cellphones, grants a reliable source for users to share their suggestions and opinions with the public. These opinions show the attitude of people towards any entity, and these opinions are essential for the interest of business analysts and users. In the past, opinions and emotions were detected for the reshaping of business organizational services and customer feedback by using NLP via sentiment analysis using a machine learning algorithm. Sentiment first presented by Jargon used for the detection of positivity and negativity from public reviews. The sentiment is a digital prediction of mood by assigning a suitable polarity score to each target word. Today, the nature of communication has changed on social media by using short forms, indirect words with the same meaning, ambiguous words from different domains (Jargon), slang, and others. Fast and real-time conversation hides the secrets of users in the overall conversation among different groups of people. The extraction of opinion from these opinionative terms is a herculean task. The aforementioned reasons make us adopt an unsupervised approach to detect the sentiment of the user according to the user context in the overall communication. SA through dictionaries and lexicons is the most suitable method for the classification of public mood into negative, neutral, and positive [9, 10]. Taboada et al. [10] proposed a lexicon-based method that assigns an appropriate polarity score to each opinionative word from the dictionary. Various entities like services, education, health, and products have been analyzed using a supervised, unsupervised, and semisupervised approach [11, 12]. Serrano-Guerrero et al. [13] expounded an unsupervised approach to mining public mood in Twitter data that used a dictionary and lexicon for the polarity score of opinionative words. [14, 15] All of these proposed unsupervised methods for the analysis of public mood.The uniqueness of this system is that it manages the overall sentiment of an individual as a context. Denecke [16] performed sentiment classification of multidomain data using the SentiWordNet lexicon and concluded that an unsupervised machine learning system performs well instead of a supervised machine learning system in multidomain classification. A great deal of work is done to analyze the public mood related to products and services on social media, but it is observed that all work has not yet been done according to the context of the user, and no system is capable of saving the context as a history backup and generating the cumulative scores of users related to the product and services in real-time conversation. Our work improves the overall performance of sentiment analysis and presents a better decision-making framework. This improved sentiment analysis framework enables the service providers and users to make better decisions while buying the mobile product. The organization and users can use the proposed system for policy-making of incoming technology and know the market trends. Sentiment analysis is now the leading trend in real-time conversation for the analysis of market things. These things have done much focus in European countries [17, 18]. Illustrate real-time emotions from the extracted content and discover the effective patterns of public opinion about politics. Bollen et al. [14] noted that these platforms have a quick response from the public towards an object or event that is a common share in the form of short text.Popescu and Etzioni [19] used the multidimensional scaling method to examine the relationships between automobile brands through text mining. Wei et al. [20] conducted sentiment analysis on Chinese crowdsourced online review data and examined the high-frequency words, major topics, subtopics, and most impactful factors that influence service rating, environment, and taste in restaurant reviews. Managerially, the synergistic benefit from customer rating and review is more referential for restaurants and customers. In the case of mobile products, data elements including graphic cost, battery consumption time, and Internet services can be determined for service satisfaction. Zhao et al. [21] determine factors for the services of airlines, including punctuality, courteous agents, space, profitability space, and clean equipment. Satisfaction of customer experience with mobile products tends to compare and evaluate the overall quality factors based on tangible and intangible services of companies. These factors are revealed by any customer having great intent according to the overall context of the customer, and it reveals the better desire of the customer and more clear facts. In mobile product companies, the factors of interaction, labor intensiveness, and customization are lower than those of other factors [22, 23]. These are important in the mobile industry because they are defined through text and cluster classification analysis, which provides more reliable context-based emotions by combining the overall sentiment of the customer in general and in session.Psychology shows the importance of context in the perception of people’s emotions [24]. When we analyze a wider view instead of one person, then it is necessary to take context into account for additional effective knowledge. This can be applied to recognize the diversity of human activity for the particular interests of informatics, association, and patterns in texts like literature, news articles, e-mail messages, and conversations. For each word pattern and specific meaning depends on the text and the context in which the text is set. Context is the part in which the word text is to be set, so taking these words to make a context degree for analysis. There are other context clues as well to add a specific meaning to any word, like text source, the reference of the text in which the text is used, and the surrounding text.What will be the next phase of the emotion reasoning tool to monitor the text from start to the end [25, 26]? In this relation, the important thing is to identify the sequence of events. The different sequences might change the effect on text emotion. After going through all the phases, emotions will be detected in the text. Along with that, the possibility of identifying the previous reaction and the behavior of any event will also be detected from text [27, 28]. Thus, gaining knowledge in context is still a challenge. It is difficult for a machine to accrue the knowledge that is presented formally, so accruing knowledge in a context may reveal the conclusion of another context, and it also allows different contexts to be compared and realm incremental knowledge in a context. Context is the history of all occurring in a period of time, the state of knowledge of a particular agent at a specific time, and the things happening at a particular time. We can say the context appears as a shared space of knowledge [29, 30].Sentiment evolved through the study of emotions. It is subjective, showing positive, negative, and neutral polarity. The emotions show the state of people’s expression, their decisions, and actions [31, 32]. Same polarity tweets have different emotions as in US presidential election 2016 Trump has better favored Hillary Clinton in the early hours. Will in context sentiment varies according to the type and formality of the text, variation of user mood over time, and no solution yet for sentiment analysis to make a reality [33]. Machine learning is specific to the domain and external manifestations of sentiment. It is important to consider the user preference and the context of text because it still lacks context-based sentiment analysis. Building a domain-specific corpus is more difficult than using the corpus domain independently, so that way we need more work on context-based sentiment analysis by using NLP tools for enhancement in sentiment analysis.Furthermore, the reasoning tool contains the association of retrieval cues in the semantic network that will be the next phase of the emotion reasoning tool to monitor the text from start to end. In this relation, the important thing is to identify the sequence of events, different sequences might change the effect on text emotion [34, 35]. After going through all the phases, emotion will be detected in the text. Along with that, the possibility of identifying the previous reaction and the behavior of any event will also be detected in the text. Context is important in organizational constraints, that is, the process of the creative active external structure of feeling and thinking. Context is important at the interpersonal level in the process of emotional regulation. Based on expectations of the workplace and colleagues when examining the process of emotional regulation, it is clear to focus on the context of emotion regulation [31, 36]. Gaining knowledge in this context is still a challenge. It is difficult for the machine to accrue the knowledge presented formally, so accruing knowledge in a context may reveal the conclusion of another context, as it also allows different contexts to be compared and realms of incremental knowledge in one context. Context is the history of all that occurs in a period, the state of knowledge of a particular agent in a specific time, and the things happening in a particular time. We can say the context appears as a shared space of knowledge [37–39]. Each entity has its own context and in a collaborative partner, the system should provide a platform to explore, express, negotiate, and recognize the shared context. Context permits us to individualize a user interface that must be able to use precise queries, and answers to the question, and the user needs pertinent info immediately. Components are knowledge-based in any dialogue context, and the essential components are dialogue memory, task memory, environmental situation, psycho-social situation, and general knowledge. Every participant does not share the same knowledge and has their own way of sharing context. Context is used implicitly, which is why it creates misunderstandings [40]. Shared context refers to a common understanding of the topological relations in each domain. It captures the knowledge of the components, input and output of components, and the rules during assembly that encapsulate behavior, reuse, and share components.Furthermore, in conversation, the words at the beginning of the introduction and at the end of the conclusion of the message have greater weight. Handling stop words and noise in general sense shifter of “not” by altering the activation function. Disambiguation is also a hot topic in the field of text analysis like homonyms, e.g., banks of the river and saving banks. There is no proper model out there yet that reflects how humans communicate. Another refinement avenue is the inclusion of the context of the previous sessions and the history score of every user to detect the finer grand emotion detection. In this study, we will perform all these steps in the real-time conversation of mobile product reviews.The existing studies focused on the prediction of visual and acoustic multimodal sentiment on CMU-MOSI, which predicts the emotional state of a complete sentence, and the performance is comparatively low for the participant’s context-based emotional state. Thus, this study proposed an application for a contextualized emotion prediction system to explore the fine-grained mechanism of emotion detection. An interactive agent was explored to conduct the experiment over sentence level emotion detection.


## 3. Proposed Methodology

Emotion prediction from text is associated a lot with an address in the literature phase. This study proposes an unsupervised framework based on dictionaries, where SWN and ad lexicons are used as backend resources in the semantic scoring of emotions. The anticipated framework takes textual input and articulates emotions in the form of negativity and positivity using the ML technique. Figure1 shows that the proposed system consists of the following six indispensable steps: input module (IM), user profiling (UP), precontext predictor (PCP), context predictor (CP), a history response store (HRS), and a cumulative context-based emotion summary (CCBES).Figure 1
Proposed research methodology.


### 3.1. Input Module & User Profiling

Data is the key source in classifying the public moods related to any entity. It is the first step towards the scrutiny of text mining. In this study, real-time mobile product reviews were collected fromhttps://amazon.com and these reviews were categorized in sentence level as well as review level. Moreover, a real-time chat application is developed to interact between users on any topic in any session. This chat application is text-based, and the data of this chat will be input into a precontext predictor. The first step in our methodology is to access users and make their profiles to save user-wise emotion context scores in the history response store. The designed model of real-time application for product feedback and context-based emotion predictor is shown in Figure 2.Figure 2
Designed model of application for context-based emotion prediction.


### 3.2. PreContext Predictor (PCP)

The efficiency of text analysis is based on the supremacy of text. The precontext predictor is actually the process of cleaning the text, which is based on five submodules: cleaning, removing all undesired tags, figures, and URLs from the input data. Text Tokenizer Tokenization is the process of streaming text into symbols, words, phrases, and other tokens. We used Python NLTK via the “word tokenize” method for data to be split into word tokens. Stop Word Removal: frequently used words in a sentence of any language are considered stop words, i.e., “a,” “the,” “of,” “have not,” “had not,” etc. are stop words. These words have no meaning in sentiment classification, so removing these words is to make the text more reduced and proper. Lemmatization is the process of converting inflected forms into their root. It is considered stemming, while lemmatization is the way in which inflected forms are converted according to the sense of their base form due to the use of an additional dictionary. We used Porter Stemmer and WordNet lemmatize for stemming and lemmatization, respectively. Parts of Speech tagging: each extracted token is assigned a grammatical tag, verb, adjective, and adverb by using the Python natural language tool kit.


### 3.3. Context Predictor (CP)

Social media is the platform where people share their feelings, thoughts, likes, and dislikes regarding any entity or object, but the analysis needs the sentiment of these texts. Therefore, the first step is to predict whether the text is opinionative or not. Opinionative text is the subject text, while nonopinionative text is considered objective text. The primary focus of subjective is to predict the ideas, thoughts, judgments, perceptions, and expressions shared about a particular entity. Here in this work, the text related to the mobile product is classified. The classification is to detect the occurrence of the word and its sense of class. The feature and particular context is the process that provides evidence of classification. It is the solution to ambiguity that comes due to the different meanings of the same words in different contexts.To predict the particular score of any sentence and the overall theme of subjectivity classification, we used the SentiWordNet dictionary to assign a tag word score to each extracted token. Based on these assigned polarity scores, emotion is predicted. That prediction of emotion can convey an opinion about the mood of people, a negative/positive emotion from the given text about any particular entity. This emotion recognition phase extracts the polarity of a tagged token and extracts its positivity and negativity weight from the available SentiWordNet lexicon. There are 334 basic emotions described in WordNet affect, divided into 4 categories [24]. The last phase of CP is negation, which expresses the opposite meaning of any word. Negation is the word like not, no, and never. For handling the negation, we will use the negation list. Negation can reverse the polarity of a word by multiplying with sentence_score = sentence_score × (−1) [41].


### 3.4. History Response Store (HRS)

The history response store is responsible for storing user-wise emotion score summaries. Precontext predictor cleans and tokenizes the text and context predictor phase extracts the sentiment of a given extract token and generates the context base emotion by using the already saved emotion summary of the respective user regarding individual, session, group, or public chat. The HRS module provides the context of already saved emotions to the context predictor and saves the coming cumulative emotions of the user as per user profiling.


### 3.5. Cumulative Context-Based Emotion Summary

Cumulative context-based emotion summary is the phase, where according to user profiling, a cumulative score of every user emotion context can be extracted. It is context-based emotion of all users: session, individual, and the general public. All these phases are accumulative according to the user.


### 3.6. Context-Based Emotion Predictor Implementation

To clearly describe the effectiveness of the proposed framework on mobile review, we have presented a workflow with selected messages. In this methodology, we have developed a tool and an algorithm that describes all phases and resources used for context-based emotion detection.


### 3.7. An Algorithm for Contextualized Emotion Detection (ACED)

We have designed an algorithm called ACED (Algorithm for Contextualized Emotion Detection) to implement the proposed model. The algorithm is presented below in Algorithm 1.Algorithm 1: Proposed ACED algorithm for sentiment detection.
Input: text data for emotion predictionOutput: emotional and sentiment score1(1)
FORT ← Token//at the end of FOR loop clean text is returned(2)
IFT is in StopwordList THEN(3)
Remove Stopword(4)
ELSE(5)
IFT is in InfectedForm THEN(6)
Lemmatize the Token(7)
Assign Part of Speech Tag(8)
ELSE(9)
Assign Part of Speech Tag(10)
END(11)
END(12)
END(13)
FORT ← Token(14)
IFT is in SentiWordNet THEN(15)
assign sentiment score(16)
ELSE(17)
IFT is in NegationList THEN(18)
reverse sentiment score(19)
ELSE(20)
assign zero to sentiment score(21)
END(22)
END(23)
END


### 3.8. Input/Output Mapping of the Proposed System

To clearly describe the effectiveness of the proposed framework on mobile review, we have presented a workflow on selected text as shown in Figure3 (see Table 1 for details).Figure 3
Input/output mapping workflow (see Table1).Table 1
List of acronyms used in the paper.
NoDescriptionAnx1∑i=1Nwscorew/N is used to estimate the one text message score where ∑​ present the score of all tokens. And Nw represent total number of tokens, this formula calculates total score of one sentence by dividing no. of sentence token NAnx2If there exist a negator in the target sentence, then this negation must be highlighted/bold and the sentiment score of text go to reverse by multiplying the score with −1 using following formula (sentence_socre × (−1))Anx31/N∑j=1Nscorej is used to estimate the individual score in which ∑​ represent the summary of text message for each individual user, where score divided by number of text messages by using 1/N in order to maintain the score within specified rangeAnx41/N∑j=1Nscorej is used to estimate the individual score in which ∑​ represent the summary of text message for each individual user, where score divided by number of text messages by 1/N in order to maintain the score within specified rangeAnx51/N∑i,j=1Nscorei+scorej this formula is used to calculate the binary score in which scorei+scorej present score of multiply user conversations, N represent total number of texts in i and j conversation and it calculate group session context-based emotion scoreAnx6CCBESG−U1=1/N∑i,j=1Nscorei+scorej present overall score of individual where scorei+scorej present individual score of users in indifferent session or group, N represent total number of texts in i, j conversation and its estimate cumulative context-based emotion summary (CCBES) of individualAnx7CCBESG−U2=1/N∑i,j=1Nscorei+scorej present overall score of individual where scorei+scorej present individual score of users in indifferent session or group, N represent total number of texts in i, j conversation and its estimate cumulative context-based emotion summary (CCBES) of individualAnx8CCBESG=1/NS∑k=1NsscoreUser1−S1+scoreUser2−S1+⋯+scoreUserK−SK present average score of all user where scoreUser1−S1+scoreUser2−S1+⋯+scoreUserK−SK is the conversations in any session, group, individual or in general, N represent total number of texts in i, j, …, k conversation and its calculate an average cumulative context-based emotion summary (CCBES) for all users


## 3.1. Input Module & User Profiling

Data is the key source in classifying the public moods related to any entity. It is the first step towards the scrutiny of text mining. In this study, real-time mobile product reviews were collected fromhttps://amazon.com and these reviews were categorized in sentence level as well as review level. Moreover, a real-time chat application is developed to interact between users on any topic in any session. This chat application is text-based, and the data of this chat will be input into a precontext predictor. The first step in our methodology is to access users and make their profiles to save user-wise emotion context scores in the history response store. The designed model of real-time application for product feedback and context-based emotion predictor is shown in Figure 2.Figure 2
Designed model of application for context-based emotion prediction.


## 3.2. PreContext Predictor (PCP)

The efficiency of text analysis is based on the supremacy of text. The precontext predictor is actually the process of cleaning the text, which is based on five submodules: cleaning, removing all undesired tags, figures, and URLs from the input data. Text Tokenizer Tokenization is the process of streaming text into symbols, words, phrases, and other tokens. We used Python NLTK via the “word tokenize” method for data to be split into word tokens. Stop Word Removal: frequently used words in a sentence of any language are considered stop words, i.e., “a,” “the,” “of,” “have not,” “had not,” etc. are stop words. These words have no meaning in sentiment classification, so removing these words is to make the text more reduced and proper. Lemmatization is the process of converting inflected forms into their root. It is considered stemming, while lemmatization is the way in which inflected forms are converted according to the sense of their base form due to the use of an additional dictionary. We used Porter Stemmer and WordNet lemmatize for stemming and lemmatization, respectively. Parts of Speech tagging: each extracted token is assigned a grammatical tag, verb, adjective, and adverb by using the Python natural language tool kit.


## 3.3. Context Predictor (CP)

Social media is the platform where people share their feelings, thoughts, likes, and dislikes regarding any entity or object, but the analysis needs the sentiment of these texts. Therefore, the first step is to predict whether the text is opinionative or not. Opinionative text is the subject text, while nonopinionative text is considered objective text. The primary focus of subjective is to predict the ideas, thoughts, judgments, perceptions, and expressions shared about a particular entity. Here in this work, the text related to the mobile product is classified. The classification is to detect the occurrence of the word and its sense of class. The feature and particular context is the process that provides evidence of classification. It is the solution to ambiguity that comes due to the different meanings of the same words in different contexts.To predict the particular score of any sentence and the overall theme of subjectivity classification, we used the SentiWordNet dictionary to assign a tag word score to each extracted token. Based on these assigned polarity scores, emotion is predicted. That prediction of emotion can convey an opinion about the mood of people, a negative/positive emotion from the given text about any particular entity. This emotion recognition phase extracts the polarity of a tagged token and extracts its positivity and negativity weight from the available SentiWordNet lexicon. There are 334 basic emotions described in WordNet affect, divided into 4 categories [24]. The last phase of CP is negation, which expresses the opposite meaning of any word. Negation is the word like not, no, and never. For handling the negation, we will use the negation list. Negation can reverse the polarity of a word by multiplying with sentence_score = sentence_score × (−1) [41].


## 3.4. History Response Store (HRS)

The history response store is responsible for storing user-wise emotion score summaries. Precontext predictor cleans and tokenizes the text and context predictor phase extracts the sentiment of a given extract token and generates the context base emotion by using the already saved emotion summary of the respective user regarding individual, session, group, or public chat. The HRS module provides the context of already saved emotions to the context predictor and saves the coming cumulative emotions of the user as per user profiling.


## 3.5. Cumulative Context-Based Emotion Summary

Cumulative context-based emotion summary is the phase, where according to user profiling, a cumulative score of every user emotion context can be extracted. It is context-based emotion of all users: session, individual, and the general public. All these phases are accumulative according to the user.


## 3.6. Context-Based Emotion Predictor Implementation

To clearly describe the effectiveness of the proposed framework on mobile review, we have presented a workflow with selected messages. In this methodology, we have developed a tool and an algorithm that describes all phases and resources used for context-based emotion detection.


## 3.7. An Algorithm for Contextualized Emotion Detection (ACED)

We have designed an algorithm called ACED (Algorithm for Contextualized Emotion Detection) to implement the proposed model. The algorithm is presented below in Algorithm 1.Algorithm 1: Proposed ACED algorithm for sentiment detection.
Input: text data for emotion predictionOutput: emotional and sentiment score1(1)
FORT ← Token//at the end of FOR loop clean text is returned(2)
IFT is in StopwordList THEN(3)
Remove Stopword(4)
ELSE(5)
IFT is in InfectedForm THEN(6)
Lemmatize the Token(7)
Assign Part of Speech Tag(8)
ELSE(9)
Assign Part of Speech Tag(10)
END(11)
END(12)
END(13)
FORT ← Token(14)
IFT is in SentiWordNet THEN(15)
assign sentiment score(16)
ELSE(17)
IFT is in NegationList THEN(18)
reverse sentiment score(19)
ELSE(20)
assign zero to sentiment score(21)
END(22)
END(23)
END


## 3.8. Input/Output Mapping of the Proposed System

To clearly describe the effectiveness of the proposed framework on mobile review, we have presented a workflow on selected text as shown in Figure3 (see Table 1 for details).Figure 3
Input/output mapping workflow (see Table1).Table 1
List of acronyms used in the paper.
NoDescriptionAnx1∑i=1Nwscorew/N is used to estimate the one text message score where ∑​ present the score of all tokens. And Nw represent total number of tokens, this formula calculates total score of one sentence by dividing no. of sentence token NAnx2If there exist a negator in the target sentence, then this negation must be highlighted/bold and the sentiment score of text go to reverse by multiplying the score with −1 using following formula (sentence_socre × (−1))Anx31/N∑j=1Nscorej is used to estimate the individual score in which ∑​ represent the summary of text message for each individual user, where score divided by number of text messages by using 1/N in order to maintain the score within specified rangeAnx41/N∑j=1Nscorej is used to estimate the individual score in which ∑​ represent the summary of text message for each individual user, where score divided by number of text messages by 1/N in order to maintain the score within specified rangeAnx51/N∑i,j=1Nscorei+scorej this formula is used to calculate the binary score in which scorei+scorej present score of multiply user conversations, N represent total number of texts in i and j conversation and it calculate group session context-based emotion scoreAnx6CCBESG−U1=1/N∑i,j=1Nscorei+scorej present overall score of individual where scorei+scorej present individual score of users in indifferent session or group, N represent total number of texts in i, j conversation and its estimate cumulative context-based emotion summary (CCBES) of individualAnx7CCBESG−U2=1/N∑i,j=1Nscorei+scorej present overall score of individual where scorei+scorej present individual score of users in indifferent session or group, N represent total number of texts in i, j conversation and its estimate cumulative context-based emotion summary (CCBES) of individualAnx8CCBESG=1/NS∑k=1NsscoreUser1−S1+scoreUser2−S1+⋯+scoreUserK−SK present average score of all user where scoreUser1−S1+scoreUser2−S1+⋯+scoreUserK−SK is the conversations in any session, group, individual or in general, N represent total number of texts in i, j, …, k conversation and its calculate an average cumulative context-based emotion summary (CCBES) for all users


## 4. Results and Discussion

In this section, we have discussed the evaluation metrics to assess the obtained results from the proposed framework on mobile reviews data presented in Table2. To evaluate the performance of the proposed system, precision, recall, f-measure, and accuracy are used.Table 2
Messages with polarity score related to mobile review.
Text inputScoreEmotionIf you are now separated from OPPO then why use shitty colour os?? try to make your OS or improve the colour os according to the customer’s needs! if you believe that your company is consumer centric. Then you should take this feedback in priority level! colour Os 5.20.16346153846153846PositiveWe are always open for feedback and suggestions from our customers to improve services. At present, we do not have exchange offers available from our side. However, you can visit the OPPO dealers or e-commerce websites to check the offers to them−0.20238095238095238NegativeI am going to share all the conversation with you. Listen and then decide what kind of oppo company is dealing with customers. I have all the call recordings. They suppress the customers’ complaints and just sell them and do not care about customers0.027777777777777776PositiveRegarding os F series upgraded, in more ways than one. #OPPOF11Pro coming soon0.1875PositiveI urge all kenyans to dodge and avoid this company until they learn to properly treat kenyans working for them. There have been numerous reports of complaints of the manager who is mistreating, insulting, overworking,and underpaying the employees−0.09868421052631579NegativeRising camera panoramic screen the first detail shots of the #OPPOF11Pro. What else do you want to see?0.10227272727272728PositiveNow people are not buying in the name of camera, that is, why they come with battery, they claim fake details about their phones, you can see people get bored with oppo that is why they launch in the name of real estate, their sales are declining day by day and complaints are increasing0.065PositiveU got complaints ABOUT EVERYTHING I THROW AT YOU. I’ve heard good things from them if I were ever to go back to evil, that is, android, I’d get an oppo0.8PositiveMy oppo mobile screen is flickering, what can I do? I have trouble opening the POSB ibanking app since the last update, with the app crashing instantly upon opening it. I am currently using an OPPO phone, and I have seen quite a number of similar complaints on the google play store too. May I ask how this can be rectified?−0.13671875NegativeSomething like: “I’m so sorry! please DM your username (details, information, etc.) so we can look & work on this for you”−0.15625NegativeBingo!! we have received a compliment of the world’s fastest charger from none other than @TechnicalGuruji, thank you for the insights0.1125PositiveThis is an interesting topic to explore, and it seems that increasingly, companies are taking advantage of the instant support they can offer via feedback. Thanks for this!0.23333333333333334Positive“The whole industry is working really hard to bring the richness of the mobile internet “one step closer” to everyone and delight them with more exciting services and experiences.” Henry Tang, director of standards, now takes us through our 5G plans0.115Positive


### 4.1. Confusion Matrix

A confusion matrix is a two-dimensional error matrix in which rows present a human-annotated instance and the columns present a machine annotated instance. It is an error matrix to show incorrectly identifier instances and measure the performance of the proposed modal [42]. The structure of the confusion matrix is presented in Table 3.Table 3
Confusion matrix.
PositiveNegativePositiveTPFNNegativeFPTNHere TP is machine predicted true positive and FP is machine predicted false positive. Where TN presents a machine labeled true negative, and FN presented a machine labeled false negative. In this study we have experienced 2220 reviews in which 1785 are opinionative, 714 are negative, 1071 are positive, 435 are neutral, 165 are marked incorrect negative, and 81 are marked incorrect positive as shown in Table4.Table 4
Classification of opinionative and nonopinionative.
Total Text2220Opinionative text1785NonOpinionative = 435Positive1071Negative714Table5 shows that the proposed system can have correctly predicted 906 positive and 633 negative, whereas 165 positive and 81 negative are mishandled due to the unavailability of more influential linguistic resources. However, it is observed that the number of correctly identified instances is greater in size just due to the high coverage of contextualized emotion prediction.Table 5
Confusion matrix of the proposed framework.
PositiveNegativePositiveTP = 906FN = 81NegativeFP = 165TN = 633


#### 4.1.1. Precision

The precision evaluates the positive predicted values. High precision values indicate that a smaller number of negative texts are incorrectly marked as positive and low precision values indicate that a high number of negative texts are marked as positive. Therefore, high precision reflects the high accuracy of true positive. It represents true positive and true negative as shown in equations (1) and (2), respectively.(1)Precision,ppositive=TPTP+FP=906906+165=84.6%,(2)Precision,pNegative=TNTN+FN=633633+81=88.7%.


#### 4.1.2. Recall

The recall is used to predict the correctly marked text from the total number of texts. The higher the recall rate, the smaller number of positive texts marked incorrectly. Table5 present both true positive and false negative, and it presents mathematically as:(3)Recall,rpositive=TPTP+FP=906906+81=91.8%,Recall,rNegative=TNTN+FP=633633+165=79.3%.


#### 4.1.3. F-Measure

Its harmonic evaluation matrix is used to find the mean of precision and recall. Mathematically, presented as:(4)F−Measure=2×precision×recallprecision+recall,F−Measurepositive=2×TP2×TP+FP+FN=2×9062×906+165+81=88%,F−MeasureNegative=2×TN2×TN+FN+FP=2×6332×633+81+165=83%.


#### 4.1.4. Accuracy

To predict how actually the measurement is close to the actual value of a significant digit. A general rule of mathematic is:(5)Accuracy=TP+TNTP+TN+FP+FN=633+906906+633+165+81=86%.


## 4.1. Confusion Matrix

A confusion matrix is a two-dimensional error matrix in which rows present a human-annotated instance and the columns present a machine annotated instance. It is an error matrix to show incorrectly identifier instances and measure the performance of the proposed modal [42]. The structure of the confusion matrix is presented in Table 3.Table 3
Confusion matrix.
PositiveNegativePositiveTPFNNegativeFPTNHere TP is machine predicted true positive and FP is machine predicted false positive. Where TN presents a machine labeled true negative, and FN presented a machine labeled false negative. In this study we have experienced 2220 reviews in which 1785 are opinionative, 714 are negative, 1071 are positive, 435 are neutral, 165 are marked incorrect negative, and 81 are marked incorrect positive as shown in Table4.Table 4
Classification of opinionative and nonopinionative.
Total Text2220Opinionative text1785NonOpinionative = 435Positive1071Negative714Table5 shows that the proposed system can have correctly predicted 906 positive and 633 negative, whereas 165 positive and 81 negative are mishandled due to the unavailability of more influential linguistic resources. However, it is observed that the number of correctly identified instances is greater in size just due to the high coverage of contextualized emotion prediction.Table 5
Confusion matrix of the proposed framework.
PositiveNegativePositiveTP = 906FN = 81NegativeFP = 165TN = 633


### 4.1.1. Precision

The precision evaluates the positive predicted values. High precision values indicate that a smaller number of negative texts are incorrectly marked as positive and low precision values indicate that a high number of negative texts are marked as positive. Therefore, high precision reflects the high accuracy of true positive. It represents true positive and true negative as shown in equations (1) and (2), respectively.(1)Precision,ppositive=TPTP+FP=906906+165=84.6%,(2)Precision,pNegative=TNTN+FN=633633+81=88.7%.


### 4.1.2. Recall

The recall is used to predict the correctly marked text from the total number of texts. The higher the recall rate, the smaller number of positive texts marked incorrectly. Table5 present both true positive and false negative, and it presents mathematically as:(3)Recall,rpositive=TPTP+FP=906906+81=91.8%,Recall,rNegative=TNTN+FP=633633+165=79.3%.


### 4.1.3. F-Measure

Its harmonic evaluation matrix is used to find the mean of precision and recall. Mathematically, presented as:(4)F−Measure=2×precision×recallprecision+recall,F−Measurepositive=2×TP2×TP+FP+FN=2×9062×906+165+81=88%,F−MeasureNegative=2×TN2×TN+FN+FP=2×6332×633+81+165=83%.


### 4.1.4. Accuracy

To predict how actually the measurement is close to the actual value of a significant digit. A general rule of mathematic is:(5)Accuracy=TP+TNTP+TN+FP+FN=633+906906+633+165+81=86%.


## 4.1.1. Precision

The precision evaluates the positive predicted values. High precision values indicate that a smaller number of negative texts are incorrectly marked as positive and low precision values indicate that a high number of negative texts are marked as positive. Therefore, high precision reflects the high accuracy of true positive. It represents true positive and true negative as shown in equations (1) and (2), respectively.(1)Precision,ppositive=TPTP+FP=906906+165=84.6%,(2)Precision,pNegative=TNTN+FN=633633+81=88.7%.


## 4.1.2. Recall

The recall is used to predict the correctly marked text from the total number of texts. The higher the recall rate, the smaller number of positive texts marked incorrectly. Table5 present both true positive and false negative, and it presents mathematically as:(3)Recall,rpositive=TPTP+FP=906906+81=91.8%,Recall,rNegative=TNTN+FP=633633+165=79.3%.


## 4.1.3. F-Measure

Its harmonic evaluation matrix is used to find the mean of precision and recall. Mathematically, presented as:(4)F−Measure=2×precision×recallprecision+recall,F−Measurepositive=2×TP2×TP+FP+FN=2×9062×906+165+81=88%,F−MeasureNegative=2×TN2×TN+FN+FP=2×6332×633+81+165=83%.


## 4.1.4. Accuracy

To predict how actually the measurement is close to the actual value of a significant digit. A general rule of mathematic is:(5)Accuracy=TP+TNTP+TN+FP+FN=633+906906+633+165+81=86%.


## 5. Comparative Analysis

To access the performance of the proposed system, an experimental comparison is presented with some existing user preference-based state-of-the-art research work. As mentioned earlier, the proposed studies aimed to cope with contextualized emotion detection; therefore, existing studies relevant to the target objects/goals are retrieved for comparison. Table6 shows the comparison of the proposed system in which three major attributes namely, “approach,” “dataset,” and “evolution” parameters are added to make a valuable comparison. It is observed that the proposed system outperforms the existing ML approaches on domain-independent data. In the past, Yadava et al. [43] conducted an experiment on product marketing advertisements by monitoring 40 participants, including 25 male and 15 female choices, to predict consumer choice on the basis of likes and dislikes of many e-commerce products. The accuracy is measured by independent testing with the help of Hidden Markov and is more effective than the other approaches, but the limitation of this approach is the robustness of the feature and classifier combinations that could be explored to improve result prediction. Zadeh et al. [44] conducted an experiment with multimodal sentiment analysis that was termed tensor fusion network dynamics on intramodality and intermodality and brought state-of-the-art results for language. The limitation is predicting visual and acoustic multimodal sentiment on CMU-MOSI. Saganowski et al. [45] conducted an experiment on context-based emotion generation on interactive intelligent chat application data by using machine learning techniques. The major limitation of this work is the ability to judge the emotional state of a complete dialogue. Kumar et al. [46] experimented with an EEG (electroencephalogram) approach on ten different products on a multimodal rating predictor for sentiment analysis of product reviews. This predictor achieves RMSE (Root mean square value) of 0.29 and R2 of 0.72 rating performance, and the limitation of this system is to consider the participant’s context-based emotional state for better performance. All these discussion results illustrate that the proposed framework surpassed the machine learning approach on domain-independent data. The underlined text shows that the outgoing precision and F measure are better than the other approaches shown below in Table 6 and mapping of this workflow is shown in all these efficiencies of the proposed system are due to the parameters of wordsense disambiguation that predict the ambiguity that comes due to different senses of class. Negation handling is bearing handling to accommodate the negation and count the opposite score of the sentence negation comes in the input text and the most significant contribution is context handling and generating user-wise context-based emotion summary and overall average score of user text. While the recall of implicit text is not promising because in our proposed framework there is a lack of implicit opinion detection, context shifter, and the need to improve our proposed algorithm time and accuracy.Table 6
Comparison summary.
StudyApproachDataset and participantAccuracy (%)Yadava et al. [43]EEG, DWT, HMM classifiers25 male, 15 female subjects70Zadeh et al. [44]TFN sentiment analysis, multimodalCMU-MOSI 93 distinct speaker74Kumar et al. [46]Artificial bee colony (ABC)EEG dataset of 40 participants67ProposedACED proposed algorithmMobile reviews data86


## 6. Conclusion and Future Direction

Microblogging and Web 2.0 have now become the most prominent communication channels. Millions of online users share their views and emotions on numerous aspects of life every day. The sentiments, opinions, appraisals, and emotions are mined for better decision-making of products, services, and policies. Sentiment analysis, opinion mining, and emotion detection are core areas in the orientation of public sentiment and emotions. It is observed that emotions are a contextualized linguistic indicator that sometimes indicates a highly emphasized opinion. Ignoring contextualized emotions may alert the overall semantic orientation. This research proposes a fine-grained system for contextualized emotion detection. An algorithm has been developed to cope with the problem of emotion orientation. SentiWordNet is used as a backend resource for sentiment scores, whereas an additional module, History Response (HR), is incorporated to achieve the maximum level of contextualized polarity. The major contribution of the proposed system is to cope with contextualized emotion detection that estimates individual, group, session, and average summary of sentiment scores by achieving 84.59% precision (Positive), 88.65% precision (Negative), and 86% accuracy with the actual value as a significant digit. Although the proposed system achieved an astonishing outcome, still there is a need for improvement in the context predictor phase. Furthermore, implicit and informal texts need to be considered in the future for more efficient sentiment analysis and emotion detection.



---

*Source: 6488848-2022-06-16.xml*