Emotion detection on social media status in Myanmar language

ABSTRACT


INTRODUCTION
In this age, social media has become rapidly popular to communicate with each other around the world. Most people daily use social media, such as Facebook and Twitter. They express their emotions, moods, share knowledge, get up-to-date local or global news, sell products by posting or sharing status with texts, videos, photos and sometimes with the feeling tag that provided by social media application. Emotions perform a key role in human cognition, particularly in human interaction, human intelligence, perception, and rational decision-making. Emotions of social media are important in some application areas such as medical treatment, pre-election result estimation, and opinion on the specific topic.
An emotion is a psychological state which includes a subjective experience, a behavioral or expressive response, and a physiological response [1]. Emotion detection is the process of identifying a person's feelings or emotions. Detecting emotion from text is a new classification task and advances in textual analysis and becomes an interest in natural language processing (NLP) field. Psychologist Ekman [2] suggested that surprise, fear, anger, sadness, and happiness as six basic emotions.
Machine learning-based and Lexicon-based approaches are the main approaches in emotion detection from the text. Many researchers do studies by applying different approaches. In a lexicon-based approach, researchers create language-related emotion lexicons which can be directly applied in emotion detection from text. In the lexicon, the words are mapped to their emotional state. This process uses a bag of words noted with their emotional bearings and clearly calculates the total number of words or masses the values included in texts. This paper presents an emotion detection system which applies both machine learning-based and lexicon-based approaches. The system aims to provide emotional information in some application areas such as election period, mental health care, criminal cases, and so on. In a lexicon-based approach, the system uses a pre-constructed Myanmar word-emotion lexicon (M-Lexicon) proposed by Swe and Myint [3] in order to extract the emotion words from the segmented part-of-speech (POS)-tagged post.
If there is one and only one emotion word or words with the same emotion value, the system can easily detect the emotion of the post depending on the emotion word value. If a post has more than one emotion word with different emotion values, the system needs to examine the emotion from such kinds of words. The problem states which word is strongly represented to express the emotion of the post. To solve this problem, rule-based detection can be applied. Rule-based detection has some facts such as there may need to define strong and complete rules, to have more new rules to get more accurate results. Machine learning-based approaches can overcome this fact.
Machine learning-based has more benefits than rule-based; the system can simply and easily detect the emotion of the social media user. So, the system applies machine learning-based, naïve Bayes (NB) and/or recurrent neural network (RNN), classifiers in the emotion detection process. This paper presents the NB emotion classifier and RNN emotion classifier to examine the emotion of the user when there is more than one extracted emotion word in the post, with different emotion values. The emotion detection system will also detect different user groups' emotions from their posts.
The rest of this paper is formed as: the next section describes the related works. It is followed by the method of the emotion detection system in detail. Before concluding remarks in section 5, results are shown in section 4.

RELATED WORKS
Most of emotion recognition work had been done for English and their mother languages (Korean [4], Vietnamese [5], France [6], and Arabic [7]). The machine learning based and lexicon based approaches can complete their works [8]. In this section, a short review of studies efforts in which lexicon and machine learning approaches are applying in emotion detection from text will be presented.
Two weighting schemes and mutual information are proposed to create Turkish emotion lexicon (TEL) [9] based on a TREMO dataset. The lexicon was enriched by using bigram and concept hierarchy methods. By applying their proposed lexicon, the performance of machine learning and the lexicon-based approaches were compared. Their experiments had shown that the utilization of their proposed lexicon orderly produced similar outcomes in emotion examination in Turkish text.
The restaurant business has achieved remarkable popularity in recent years. The positive review on the restaurant services is important to attract new customer as well as to maintain the existing customer. Thus, sentiment analysis on the positive or negative reviews on the restaurant service become important facts. A sentiment classification system [10] had been proposed to analyze negative and positive classes of the customer reviews based on their hazy feedback in Bengali language. They use multinomial NB classifier in restaurant service classification. Their classifier can classify 84% of positive and 74% of negative reviews correctly. They used small dataset.
Deep learning-based emotion analysis on Arabic tweets are developed [11]. They used deep convolutional neural networks (CNN) for Arabic sentence categorization tasks. They compared their approach with three machine learning algorithms like support vector machines (SVM), multi-layer perceptron (MLP), and NB. They used count-vectorized and term frequency-inverse document frequency (TF-IDF) schemes in calculating the accuracy. They applied Arabic tweets dataset grant by SemiEval with four emotion categories: fear, anger, sadness, and joy. Their way attained exceptional results with 99.82% validation accuracy, and 99.90% training accuracy.
RNN is applied on the sentiment analysis of Spanish Tweets [12]. They proposed a modified version of feedforward RNN, namely long short-term memory (LSTM) cells. Their architectures used the combination of sentiment lexicon values and input word vector. They tested their architectures on three test datasets: InterTASS, 1k TASS, and full TASS. Their experiments have shown that sentiment analysis performance can be enhanced by their combined features but not best performance. Their methods needed to perform better preprocessing of input at word level.

STUDIES METHOD
This paper presents an emotion detection system on Facebook status/post written in Myanmar (Burmese) language. The detection system uses Facebook user's posts and detects the emotion of the user from the post. The system additionally provides the emotion of the user and groups of users on their personal profile information such as educational status, occupation or work, birth date, and gender. The system first determines whether the post is a feeling status. If the status is with the feeling tag, the system examines the emotions from the feeling word using the feeling-emotion lexicon, which is a sub-lexicon in M-Lexicon. If not, the system performs the emotion detection process using classification methods. The emotion detection includes three main parts: data pre-processing, M-Lexicon-based emotion words extraction, and emotion classification using machine learning-based approaches. The collected Facebook status is preprocessed with three steps such as word segmentation, stemming word and POS tagging, and stop word removal. The words from the preprocessed step are used to extract the emotion words. The extracting process is completed by finding the word in the lexicon. The extracted words with the related emotion values are used to examine the emotional label for the post. The general architecture of the detection system is illustrated in Figure 1.

Data collection and pre-processing
Facebook has become the most popular social medium around the world. Facebook had 2.92 billion members worldwide by the end of 2021 [13]. Facebook permits their users to pick the particular "networks" that they owned, such as geographic location, education, and occupation/work. Each user retains a "profile", that shows the fundamental facts like hometown, graduation and also personal information: username and whether the user is "in a relationship" or single (i.e., "relationship status") and so on. The system collects 27 Facebook user profile information such as education, graduation, work, date of birth, and gender. Facebook provides several communication ways between their users. Users communicate with each other by sending private messages. In addition, the users can express their feelings, emotions, photos and videos by posting status on each other's Walls [14]. Facebook posts can contain the feeling status. A Facebook post includes the following information: post owner (with the tag friend-in some post), posted time, post content and reactions to the posts. There are six types of animated reactions: 'classic like', 'love', 'haha', 'sad', 'wow', and 'angry'. The system stores the text posts and posts with feeling tag of each Facebook user. The reaction counts of the post are also kept with it. The collected data is preprocessed before the emotion word extraction process is performed. The pre-processed steps contain three main processes: segmentation on Myanmar text post, the stemming word and POS tagging process, and stop word removal process as last step.

Word segmentation
Myanmar (Burmese) language is the Sino-Tibetan language spoken by 30 million people and the official language in Myanmar. In Myanmar script, the sentences are written in left to right style and obviously divided by a sentence boundary marker. In spite of the fact that inter-phrase spacing may sporadically to be employed, there is no typical inter-word spacing [15]. In Myanmar writing, white spaces do not use between words or between syllables. A Myanmar text is a characters string which does not have explicit word boundary delimiters. So, the word segmentation is an important stride preceding the emotion detection from the text.
The word segmentation can be done by using a segmentation tool, namely Myan-Word-breaker [16]. Myan-Word-breaker performs a segmentation process in syllable segmentation and syllable merging steps. By using rule-based heuristic approach, the syllable segmentation process is acted in which the sentence is segmented by defined six rules [17]. By using the dictionary-based statistical approach, the segmented syllables are combined into words afterwards the syllable segmentation is done. In some cases, the segmented result is re-merged manually to better segmented results. The result of the system segmentation process is shown in Table 1.

Stemming and part-of-speech tagging
Segmented word may contain the repeated word or need to reduce it with the same root to an accepted form. For example, in English, the words chocolates, chocolatey and choco as being the same and derived from chocolate. The stemming process is mostly done in three ways: rule-based stemming, statistical stemming, and hybrid stemming. In this emotion detection system, a rule-based stemming way is applied in the stemming word. This process, the word stemming process, is performed before the POS tagging process. Table 2 shows some stemming rules of the system. The algorithm of the stemming process is described in Figure 2. The system finds root word of each segmented word within the stemming rules. If there is a matched rule, the system replaces the searched word with the root word of it. The system continues the process until the end of segmented words.  After segmentation and stemming word processes are performed, the system applies POS tagging so as to continue the finding and removing the stop words as the next step. POS tagging is a process to classify words in the text in association with a particular part of speech, depending on the meaning of the word and its context. The POS tagger sets a POS tag to each word in a given sentence. This emotion detection system uses Myanmar POS (myPOS) corpus [18], [19] and ripple down rules-based part-of-speech tagger (RDRPOS) tagger [20], a fast and simple to use and language free toolkit, to tag the segmented Facebook post body.

Stop word removal
There may have words in the POS tagged text which are not important or not required to use in the lexicon creation and emotion detection process because it does not have much meaning to express the emotion of user. Thus, the system removes such kind of words, stop words, after the POS tagging process. Stop words, by definition, are unmeaning words with very low differentiation value [21]. Pronouns, conjunctions, prepositions, and particles are usually stop words. Those words that are not associated with an emotion do not contribute to detection process, and therefore they are unnecessary. These words list will be predefined for this system. There are 275 predefined stop words that are listed. In addition to this, the system also defined POS tag set for the stop word list. If a word is in the stop word list, the system removes it from the POS tagged text. If not, the system also finds the word in the stop word POS tag set. If the word is in the set, the system removes it. The stop word removal results of the system are shown in Table 3.

Emotion word extraction
After the pre-processing steps are done, the next step is the emotion word extracted by using the Myanmar word-emotion lexicon. Myanmar word-emotion lexicon, M-Lexicon that involves words with the related six emotions values. The words from the pre-processing result list are matched with the words of the M-Lexicon. If a word is settled in the lexicon, the correlated emotion value is also extracted with it and marked as an extracted emotion word. If the word is not in the M-Lexion, it will be removed from the list. Figure 3 shows the emotion word extraction process of the system.

Emotion detection
After all, words are matched with the Myanmar word-emotion lexicon words, the system checks, and the extracted word is either a single list or the same emotion value list. If so, the system skips the emotion detection process using machine learning approaches and processes to examine the emotional label step. If there is more than one emotion word with different emotion values, the system goes through the emotion examining process using machine learning approaches. The emotion detection process is shown in Figure 4.

Machine learning based emotion detection
As described in previous section, this process step is worked only when there is more than one emotion word with different emotion values. The system applies RNN emotion classifier and multinomial NB classifier to detect the emotion from the status that contains two or more words with different emotion values. This section will describe that how the two-machine learning based methods are used in emotion detection.

Multinomial naïve Bayes emotion classifier
The system applies multinomial naïve Bayes classifier to examine the emotion from the extracted emotion word for the post and user. NB is a probabilistic classifier which returns the class * . The class has the maximum posterior probability given the post as in (1). To return the emotion class, the most probable class * is computed by giving some post by selecting the class which has the highest product of the prior probability of the class ( ) and the likelihood of the post ( 1, 2, … , 1,\ ). The value of the count of word with a given class ( , ) + 1 is divided by the sum of the class count ( ) and total words count | | as in (2). The result of total number of a given class is divided by the total count of all class is to obtain the prior probability of class as in (3) (1) The classifier accepts a status and its emotion words extracted by using M-Lexicon and creates a dataset where each status contains the words. The dataset contains the emotion class label (A-F for six emotions) on each status. The classifier creates a text-post vectorized matrix using the extracted emotion words by counting the times of emotion words that appear in each post. The classifier then calculates prior probability, posterior probability, likelihood and finally performs the emotion class label classification and sets the class label for the status. Figure 5 shows the naïve Bayes emotion classifier process.

Recurrent neural network (RNN) emotion classifier
RNN [22] is the extension of the artificial neural network (ANN) that contains memory to understand sequential data. The output depends on previous inputs and performs the same task for all input and output data recurrently. There are three types of RNN architecture such as one to many, many to one, and many to many. This detection system uses many to one RNN architecture where the extracted emotion words are used as input. The input size is equal to the words count. The hidden size is one in which the neuron size is smaller than or equal to the input size. The output layer produces the emotion class label. The rectified linear unit (ReLU) [23] activation function (5) is used in (4) for calculating the hidden state output.
The SoftMax activation function (7) is used in (6) to calculate the output (y) of the output layer.
The input words (x) are encoded by using one-hot encoding [24] and the input weight matrix (Win) is obtained by finding corresponding vector in the pre constructed word embedding matrix. The word embedding matrix was constructed by using word to vector (Word2Vec) [25] continuous bag of words model (CBOW) with the words of M-Lexicon. The recurrent weight matrix ( ) and output weight matrix ( ) are constructed in which the matrix value is filled by He initialization [26] method. The RNN emotion classifier, shown in Figure 6, takes the extracted emotion words as inputs. The classifier encodes the input words and creates weight matrices. The classifier calculates each hidden state and produces the classifier result by using (8).

Emotion detection result
As discussed in section 3.3, the emotion detection system accepts the segmented POS tagged post as an input. The system finds and deletes the stop words from the input. The system then extracts the emotion words from the input by applying M-Lexicon. If there are more than one emotion word with the different corresponding emotion values (disgust, surprise, anger, fear, sadness, and happiness), for instance ဝမ် ်းသာ (happiness) (1, 0, 0, 0, 0, 0), စိ တ် ညစ် (sadness) (0, 1, 0, 0, 0, 0), the system applies the machine learningbased emotion classifiers. The system produces the detected result from the output of the applied classifiers.

RESULT AND DISCUSSION
After implementing the emotion detection system on social media status written in Myanmar language, the system is tested by using 2,000 Facebook status of 27 users. The system defined the reaction-emotion mapping as 'Love' and 'Haha' reactions are concerned with the 'Happiness' emotion, and the 'Sad', 'Wow' and 'Angry' reactions are referred to the 'Sadness', 'Surprise' and 'Anger' respectively. The mapping value is used in the M-Lexicon creation process and emotion labeling process by the expert.
The system experiments by calculating precision, recall, F-measure, and accuracy. Each post is manually labeled as the emotion class by experts which is to be used in performance calculation. Precision is the number of true positive class predictions, and the value is the number of accurately labeled posts retrieved by the process divided by the total number of posts retrieved by the process. The recall statistic is a measure of how well the classifier performs on positive examples in the status dataset. The value is the total number of posts truly labeled and retrieved by the process divided by the number of correctly annotated posts. The F-measure or F1 score is calculated by the results of the precision and recall, and it is the harmonic mean of precision and recall taking both metrics into account. According to Tables 4 and 5, the experiment result shows that average 85% accuracy in NB emotion classifier while 86% accuracy in RNN emotion classifier. The study also tested the time performance of both two machine learning methods for emotion detection which result indicates that the NB emotion classifier is lighter than RNN emotion classifier.

CONCLUSION
This paper presented an emotion detection on social media (Facebook) user status. Before examining the emotion of the user from the status, the status content is preprocessed. In the preprocessing step, the content is segmented, stemmed, and performed POS tagging process using myPOS and ripple down rules-based part-of-speech tagger (RDRPOS) tagger to continue the stop word removal process. This system applies our constructed M-Lexicon to extract the emotion words from the status. If there is more than one emotion word with different emotion values, the system applied machine learning based approaches: NB classifier and compared with the RNN emotion classifier. The system produces the emotion class upon the classification result. The system directly produced the emotion class label upon a single word or emotion words with same emotion value. The system tested on 2,000 Facebook status of users. The system states that 86% correctly annotated emotion class by RNN when 85% accuracy in NB classifier. This system does not provide emotion detection from the emoticon, slang words, and negative words.