Negation-aware Framework for Sentiment Analysis in Arabic Reviews Rehab M. Duwairi Department of Computer Information Systems Jordan University of Science and Technology Irbid 22110, Jordan
[email protected] Abstract— Sentiment analysis deals with identifying polarity orientation embedded in users’ comments and reviews. It aims at discriminating positive reviews from negative ones. Sentiment is related to culture and language morphology. In this paper, we investigate the effects of language morphology on sentiment analysis in reviews written in the Arabic language. In particular, we investigate, in details, how negation affects sentiments. We also define a set of rules that capture the morphology of negations in Arabic. These rules are then used to detect sentiment taking care of negated words. Experimentations prove that our suggested approach is superior to several existing methods that deal with sentiment detection in Arabic reviews. Keywords—Sentiment analysis; sentiment detection; opinion mining; language morphology; valence shifters.
I.
INTRODUCTION
Sentiment Analysis (SA) is a task during which the polarities of comments or reviews are determined. Generally, SA is concerned with deciding whether a comment is positive, negative or neutral [27, 13]. SA has many applications and is important to companies and organizations. It is always important for companies or organizations to judge their customers’ acceptance of their products or services. The objects addressed by SA vary in granularity. Typically, three levels have been addressed in the literature: document/review level, sentence level, and aspect level. Document or review level predicts the polarity of the whole document or review. This is the easiest but most coarse level. In practice, people tend to express positive and negative sentiments in one review. Sentence level, on the other hand, attempts to identify sentiments at the sentence level. This level is more refined when compared with the first level but still fails to identify the entities and their respective features or aspects which were intended by the declared sentiment. The third and final level deals with sentiment at the entity and its features or aspects. At this level, it is not enough to say that this review is positive or negative. It is important to identify the aspect and the entity that were addressed by the person who posted the review or comment. The work reported in [10, 22, 28, 29] are examples of aspect-based SA.
Mohammad A. Alshboul Department of Computer Engineering Jordan University of Science and Technology Irbid 22110, Jordan
[email protected] It is common to approach SA as a supervised learning task [27, 13, 15]. Here, SA becomes a classification task with three classes, namely, positive, negative, and neutral. The reviews are represented using the Vector Space Model (VSM). This, basically, builds a term-document matrix which assigns a weight to every term which appears in every review. Weighting schemes vary from binary weights to more sophisticated weights such as TFIDF. When using VSM, words or terms’ order is lost. In other words, VSM does not take the morphology of the language into consideration. Most of the existing research falls in this category. For example, see the work reported in [1, 2, 3, 4, 8, 16, 17]. Other searchers have dealt with SA as an unsupervised learning task. Here, the researchers rely on the fact that words have prior sentiment irrespective of the sentences which they are used in. In this approach, it is imperative to use a sentiment lexicon that identifies the prior sentiment of words [12]. Many sentiment lexicons exist for the English language such as the word reported in [30, 31]. The approaches that utilize sentiment lexicons mostly determine the polarity of a given review by summing the sentiment weights of positive words and the sentiment weights of negative words. This is a very simplistic approach and ignores language issues which can flip the prior polarity of words. For example, negation flips the polarity of a positive word into a negative one and vice versa. The work reported in [23] suggests a method for dealing with negation when lexicons are used for SA in the English language. From our experience, we know that SA is language and culture dependent. To effectively use unsupervised learning for SA, we need to consider morphology. In this paper, we propose a framework for unsupervised SA which takes morphology into consideration. We target the Arabic language which is morphologically rich. Valence shifters such as negations, intensifiers and diminishers affect prior sentiment of words or phrases. Here, we focus on negation in the Arabic language and its relationships with SA. To this end, we have built a sentiment parser which is capable of dealing with the various forms of negation in Arabic. The parser utilizes a set of rules that were built after extensive analysis of negation
forms in Arabic. This work focuses only on Modern Standard Arabic. Dialectical Arabic has been addressed by our previous work [14]. This paper is organized as follow. Section I has introduced the research described in this paper. Section II, by comparison, illustrates some related work. Section III demonstrates the relationship between negation and SA in Arabic. It also lists the rules that were defined to deal with negation. Section IV describes the framework for handling negation. Section V, on the other hand, provides examples of the parser in action. Finally, Section VI concludes this paper. II.
RELATED WORK
Handling negation is very important for sentiment analysis. The VSM representation of two sentences that differ in only one of them uses a negation particle can be very similar or even identical [26]. For example, "I like this movie" and "I do not like this movie" can end up having the same feature vector representation in the VSM model. In SA, the two sentences end up in two opposite classes. The first sentence belongs to the Positive class and the second one belongs to the Negative class. Various alternatives for handling negation exist for the English language. For instance, Das and Chen [9] suggest adding the particle "Not" to words which occur near negation words. This is rather a too simplistic approach. Na et al [25] proposes a better treatment of negation by taking part of speech (POS) into consideration. Their method gave 3% overall improvement over baseline experimentations. The work reported in [11] proposes a statistical parsing framework for dealing with sentiment analysis. The developed statistical parser is capable of handling negation, intensification and mitigation (Diminishers). The set of rules is learnt from data, in contrary to our work – where the set of rules that handle negation are determined based on linguistic knowledge. Wilson et al [32], by comparison, developed a framework for SA at the phrase level. Their work relies on words prior polarities (as in sentiment lexicons) and grammatical relationships between the components of a given sentence (as in the parse tree of that sentence) to derive the set of features which is subsequently used to train a two-stage classifier. In the first stage, polar phrases are distinguished from neutral phrases. In the second stage, the polar phrases are classified into positive, negative, both or neutral. The best accuracy of the first stage was equal to 75.9 and the best accuracy of the second stage was equal to 65.7. ArSenL is a large-size sentiment lexicon for the Arabic language [6] it was built by using two approaches. The first one maps entities in Arabic Word Net [7] to English Sentiment WordNet (ESWN) [5, 18]. The Second approach uses the SAMA [20] morphological analyzer to map lemmas in SAMA to ESWN. The lexicons are combined into one lexicon which contains 157969 entities with their sentiment
orientation according to their part of speech tags and patterns. This sentiment or polarity is expressed as a tuple which consists of three values (Probability-Positive, ProbabilityNegative, Probability-Neutral). For example, the word “”ولد (Boy in English) as a noun is listed twice in ArSenL. In the first time, it is considered neutral and thus it is represented as (0, 0, 1). In the second time, “ ”ولدas a noun is represented as (0.25, 0, 0.75) and thus it is considered both positive and neutral. Finally, “ ”ولدas a verb means ‘to give birth’ is represented as (0, 0, 1) in ArSenL. ArSenL does not investigate the effects of valence shifters on the polarity of words. Nevertheless, ArSenL is a valuable tool which can be integrated in other frameworks. In the current work, we used ArSenL to give us the polarity of words in isolation and then our rules were applied to deduce the final sentiment of phrases taking context into consideration. Abbasi et al [1] perform SA for blogs written either in Arabic or English on web forums. The purpose of their study was to detect hostility on the web forums. They employed a set of syntactic (Such as POS tags and stemming) and stylistic (Such as character n-grams) features to represent the comments. They conclude that combining syntactic and stylistic features improves the accuracy of their system. Farra et al [19] described an SA method that targets sentences in Arabic documents. This approach relies on a set of features to represent each sentence. Examples of these features include frequency of positive, negative and neutral words in every sentence, frequency of negations, use of special characters, frequency of emphasis words, and frequency of contradiction words. Afterwards, the feature vectors of the documents were fed to the J48 Decision Tree classifier and the accuracy of classification was 62%.
III.
NEGATION IN ARABIC AND ITS RELATION TO SENTIMENT ANALYSIS
The difficulty of studying negation particles in Arabic stems from the fact that linguists did not pay attention to this topic as an independent field; instead, it has been always studied as part of other topics. For example, the negation particle “”لن was always studied as a part of ()أدوات النصب, and the particle “ ”لمwas always studied as a part of ( )أدوات الجزمand so on [33]. This made it more challenging to study and analyze negation particles from these wide and distributed topics. After analyzing the negation particles, we found that there are 5 important particles which are widely used in Arabic. Furthermore, we found that we can separate these tools into two groups according to their location in the sentence structure: Group A: This group contains negation particles that can only appear immediately before verbs; this group includes 4 of the 5 negation particles. These are ( ال، لن، لم،)ما. It is relatively easy to handle the effects of these particles on the overall
sentiment. The sentiment bearing verb always appears after the sentiment particle regardless of the sentence structure.
R1: If ArSenL(Word) is Positive then Label(Word)=Positive. R2: If ArSenL(Word) is Negative then Label(Word)=Negative.
Group B: This group contains only one particle ()ليس, but it is more confusing to determine the words affected by it, since it can work in many different sentence structures. It may affect a noun phrase or a verb phrase; when it affects a verb phrase it will flip the sentiment of the first verb following it. On the other hand, when it affects a noun phrase, it will flip the sentiment of the ([ )خبرpredicate of a nominal sentence] in the sentence, but since it is not easy to distinguish between the ( )خبرand ([ )مبتدأsubject of a nominal sentence], we will negate the two nouns following the negation particle. This decision will not affect the overall sentiment because often the ()مبتدأ doesn’t have any sentiment (i.e. its sentiment equals zero), so multiplying it by (-1) will not affect the sentence overall sentiment. Table 1 lists the negation particles in Arabic and explains their effects on SA. Kindly refer to Section 5 for examples of sentences with negation particles. TABLE 1: NEGATION PARTICLES AND THEIR EFFECTS Negation Particle
BuckWalter Transliteration
Category
Effect
لم
lam
Group A
لن
Lan
Group A
ال
lA
Group A
ما
mA
Group A
ليس
laysa
Group B
Affects the verb after the particle Affects the verb after the particle Affects the verb after the particle Affects the verb after the particle Affects the following two nouns or affects the following verb.
After further analysis of the negation effect, we found that it is not accurate to just multiply the negated sentiment by (-1) as an effect of the negation particle. Instead, we found the magnitude of the multiplied coefficient should be less than (1), since the negation particle reflects the sentiment of the affected word and reduces the strength of its meaning. For example, let’s say that the word (( )يحبlove) has sentiment of (+3) and the opposite of it (i.e. ( )يكرهhate) has sentiment of (-3), we found that negating ( )يحبdelivers a less strong negative sentiment than the word ()يكره, so the sentiment of the word after negating (i.e. ) ال يحب (not love) should have negative magnitude less than the magnitude of the original word (i.e. 3). Based on the above, we defined a set of rules to deal with negation as a sentiment flipper. These rules take into consideration the group to which the negation particle belongs and the parse tree of the Arabic sentence. Assume Word refers to a unigram token, Group-A and Group-B are two Boolean variables which indicate that the current negation particle belongs to Group-A or Group-B respectively, and ArSenL(Word) returns the sentiment value of Word, then the set of negation rules are described as:
R3: If ArSenL(Word) is Negative and is Group-A=True then Label(Word)=Positive. R4: If ArSenL(Word) is Positive and is Group-A=True then Label(Word)= Negative. R5: If ArSenL(Word) is Negative and is Group-B=True then Label(Word)=Positive. R6: If ArSenL(Word) is Positive and is Group-B=True then Label(Word)= Negative.
IV.
HANDLING NEGATION
Our framework for handling negation, when deciding on the polarity of a given phrase or sentence, assumes the existence of a sentiment lexicon which decides the prior sentiment of Arabic words. To this end, we have used the ArSenL lexicon [6] which was described in Section II. The framework passes over the following steps in order to extract the sentiment of the input sentence. 1. Tokenization. The Arabic sentence or phrase is partitioned into tokens or words. 2. Generate parse tree and determine the POS for each token using Stanford parser [21]. 3. Remove stopwords using the list defined in the Ayaspell Project [34]. Ayaspell contains 13,015 forms of stopwords in the Arabic language [35]. 4. Use BuckWalter transliteration [24] to represent the Arabic letters in the token to be consistent with the format of ArSenL. 5. For each token, do the following: a. Check if this token exists in ArSenL. If yes, assign its sentiment weight to the total sentiment result, else, move to step b. b. Extract all morphological derivations for this token using the Standard Arabic Morphological Analyzer (SAMA) [20], and choose the terms that have POS which match the POS of the desired token, and then check if this term exists in the ArSenL lexicon. If yes, assign its sentiment to the total sentiment result, else, move to step c. c. Stem, using SAMA, all the terms extracted using the morphological analyzer in step (b), and choose the terms that have POS which match the POS of the desired token, and then check if this term exists in the ArSenL lexicon. If yes, assign its sentiment to the total sentiment result, else this token has no sentiment, so it will add 0 to the total sentiment result. The idea of using SAMA is to increase the number of hits between the tokens which exist in ArSenL and the tokens that we want to detect their sentiment. Arabic is morphologically rich and thus a given words may have many forms. 6. Apply negation rules as described in Section III.
7.
Calculate the sentiment strength of the given phrase or sentence. The sentiment values we receive from the (ArSenL) database are represented by 3 probabilities (positive, negative, objective), ranging from (0 to 1) for each as described in Section II. We calculated the sentiment for each word by subtracting the negative probability from the positive probability (pos-neg). This will result in a number in the range (-1, 1). In order to be consistent with existing literature, we scaled the range to become (-5, 5). Finally, we calculate the overall sentiment of the whole sentence by taking the average of all subjective words in the sentence.
rules, which we call negation rules. These rules are capable of deciding the true polarity or sentiment of phrases written in Arabic. This paper has demonstrated the ability of our sentiment parser to capture various forms of negation. In the future, we plan to extend the work of this parser to deal with intensifiers and diminishers. ACKNOWLEDGEMENT This Project is supported by Jordan University of Science and Technology, grant No. 20130174. TABLE 3: EXAMPLES OF NEGATED PHRASES BY PRACTICES FROM GROUP-B
V. NEGATION EXAMPLES Table 2 shows examples of Arabic sentences that contain negation particles which fall in Group A. The table shows the positive sentence ““ أعجبني الكتابwhich means “I like the book” in English associated with negation particles. The Arabic word which is affected by the negation particle is marked in boldface. By contrast, the negation particle is underlined. Our sentiment parser is capable of detecting the negation particle and the word it affects or flips its sentiment. All the sentences, shown in Table 2, will be given a negative sentiment by the parser. The values, shown in column 4 of Table 2, are calculated by summing the sentiment values of tokens which exist in the sentence under consideration. Negative values indicate negative sentiment; positive values indicate positive sentiment, and zero indicates neutral.
Example
1
ما أعجب الطالب الكتاب الكتاب ما أعجب الطالب
2
3 4
5 6 7 8
Buckwalter Transliteration mA >aEjaba AlTul~Ab Alkitab Alkitabu mA >aEjaba AlTul~Ab
Sentiment Value -1.56
لم يعجب الطالب الكتاب الكتاب لم يعجب الطالب
lam yuEjibony Alkitabu
-1.56
Alkitabu lam yuEjibo AlTul~Ab
-1.56
لن يعجب الطالب الكتاب الكتاب لن يعجب الطالب ال يعجب الطالب الكتاب الكتاب ال يعجب الطالب
lan yuEjiba AlTul~Ab Alkitabu Alkitabu lan yuEjiba AlTul~Ab lA yuEjibu AlTul~Ab Alkitabu Alkitabu lA yuEjibu AlTul~Ab
-1.56
Arabic Sentence
Buckwalter Transliteration
Actions of the sentiment parser
Sentiment value
1
ليس خالد مزعج (not Khalid is annoying)
laysa xAlidN muzEij
3.4
2
خالد ليس مزعج (Khalid is not annoying) ليس يزعج خالد الطالب (not annoying Khaled the students) خالد ليس يزعج الطالب (Khalid is not annoying the students) ليس خالد يزعج الطالب (not Khalid is annoying the students)
xAlidN laysa muzEij
Flips the sentiment of the first two words after laysa. To guarantee flipping the polarity of muzEijF. Flips the sentiment of the word after laysa.
Flips the sentiment of the first two words after laysa. To guarantee flipping the polarity of yuzEijuny. Flips the sentiment of the word after laysa.
3.4
Flipping the labels of the first two tokens that appear after laysa.
3.4
3
TABLE 2: EXAMPLES OF NEGATED PHRASES BY PRACTICES FROM GROUP-A No.
No.
4
-1.56 5
laysa yuzEiju xAlidN AlTul~Ab
xAlidN laysa yuzEiju AlTul~Ab
laysa xAlidN yuzEijuny
3.4
3.4
-1.56 -1.56 -1.56
Table 3 illustrates examples of Arabic sentences which contain the negation particle “”ليس. This particle is a member of Group B. Sometimes, we need to flip the prior polarity of the two words which are located immediately after the particle laysa. Note that, the sentence ليس خالد مزعجindicates positive sentiment even though مزعجis a positive word. VI. CONCLUSIONS AND FUTURE WORK This paper has addressed negation effects on the polarity of sentences written in Arabic. A thorough investigation of negation particles in Arabic has led to the development of
REFERENCES [1]
[2]
[3]
[4]
Abbasi A., Hsinchun C., and Arab S. Sentiment analysis in multiple languages: Feature selection for opinion classification in Web forums. ACM Transactions on Information Systems (TOIS). Vol. 26, no. 3, 2008, pp. 1-34. Ahmad K., Cheng D., and Almas Y. Multi-lingual Sentiment Analysis of Financial News Streams. Proceedings of the 1st International Workshop on Grid Technology for Financial Modeling and Simulation, Palermo, Italy, 2006. Ahmad K., and Almas Y. Visualizing Sentiments in Financial Texts. Proceedings of the Ninth International Conference on Information Visualization. 2005, PP. 363 – 368, Washington, USA. Alec G., Bhayani R., and Huang L. Twitter sentiment classification using distant supervision. CS224N Project Report, Stanford, 2009, pp. 112.
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]
[18]
[19]
Baccianella S., Esuli, A., & Sebastiani, F. (2010, May). SentiWordNet 3.0: An Enhanced Lexical Resource for Sentiment Analysis and Opinion Mining. In LREC (Vol. 10, pp. 2200-2204). Badaro G., Baly R., Hajj H., Habash N., El-Hajj W. A Large Scale Arabic Sentiment Lexicon for Arabic Opinion Mining. In Proceedings of ANLP 2014, pp. 165-173, 2014. Black W., Elkateb S., & Vossen P. (2006). Introducing the Arabic wordnet project. In Proceedings of the third International WordNet Conference (GWC-06). Boiy E., and Moens M.F. A Machine Leaning Approach to Sentiment Analysis in Multilingual Web Texts. Information Retrieval. Vol. 12, Issue 5, 2009, pp. 526 – 558. Das S., and Chen M. Yahoo! for Amazon: Extracting market sentiment from stock message boards. In Proceedings of the Asia Pacific Finance Association Annual Conference (APFA), 2001. Ding X., Liu B., Yu P.S. A holistic lexicon based approach to opinion mining. Proceedings of the International Conference on Web Search and Web Data Mining (WSDM’08), 2008, pp. 231–239. Dong L., Wei F., Liu S., Zhou M. and Xu K. A statistical parsing framework for sentiment classification. To appear in Computational Linguistics, pp. 1 – 44. 2015. Duwairi R., Mahyoub N., Alrefai S. Detecting Sentiment Embedded in Arabic Social Media – A Lexicon-based Approach. Journal of Intelligent and Fuzzy Systems, to appear, 2015. Duwairi R., El-Orfali M. A Study of the Effects of Preprocessing Strategies on Sentiment Analysis for Arabic Text, Journal of Information Science. Vol. 40(4), pages 501-513, 2014. Duwairi R. Sentiment Analysis for Dialectical Arabic. The 6th International Conference on Information and Communication Systems (ICICS), Amman, Jordan, 7-9 April, 2015. Duwairi R., Qarqaz I. Arabic Sentiment Analysis using Supervised Classification, The 1st International Workshop on Social Networks Analysis, Management and Security (SNAMS - 2014), August 2014, Barcelona, Spain. El-Halees A. A. Arabic Opinion Mining Using Combined Classification Approach. Proceedings of the International Arab Conference on Information Technology (ACIT), 2011, Riyadh, Saudi Arabia, Dec. Elhawary M., and Elfeky M. Mining Arabic Business Reviews. Proceedings of the IEEE International Conference on Data Mining. 2010, pp 1108 – 1113, Dec, Mountain View, USA. Esuli A., & Sebastiani F. (2006). Sentiwordnet: A publicly available lexical resource for opinion min-ing. In Proceedings of LREC (Vol. 6, pp. 417-422). Farra N., Challita E., Assi R.A., Hajj H. Sentence-Level and DocumentLevel Sentiment Mining for Arabic Texts. Proceedings of the ICDM Workshop, 2010. pp. 1114-1119.
[20] Graff D., Maamouri M., Bouziri B., Krouna S., Kulick S., & Buckwalter T. (2009). Standard Arabic Morphological Analyzer (SAMA) Version 3.1, 2009. Linguistic Data Consortium LDC2009E73. [21] Green S. and D. Manning C. 2010. Better Arabic Parsing: Baselines, Evaluations, and Analysis. In COLING 2010. [22] Hu M., and B. Liu B. Mining opinion features in customer reviews. Proceedings of the Nineteenth National Conference on Artificial Intelligence (AAAI), 2004, pp. 755–760. [23] Liu B., Sentiment analysis and subjectivity. In Handbook of Natural Language Processing. 2nd edition. ed. N. Indurkhya and F. J. Damerau. [24] Maamouri M., Bies A., Buckwalter T., & Mekki W. (2004). The Penn Arabic Treebank: Building a large-scale annotated Arabic corpus. In NEMLAR Conference on Arabic Language Resources and Tools. pp. 102-109. [25] Na J.C., Sui H., Khoo C., Chan S. , and Zhou Y. Effectiveness of simple linguistic processing in automatic sentiment classification of product reviews. In Conference of the International Society for Knowledge Organization (ISKO), pages 49–54, 2004. [26] Pang B. and Lee L. Opinion mining and sentiment analysis. Foundations and Trends in Information Retrieval, Vol. 2, No. 1-2, pp. 1-135, 2008. [27] Pang B., Lee L., and Vaithyanathan S. Thumbs up? Sentiment classification using machine learning techniques. Proceedings of the 40th Annual Meeting on Association for Computational Linguistics (ACL 2002), 2002, pp. 79–86. [28] Popescu A., and Etzioni O. Extracting product features and opinions from reviews. Proceedings of the Conference on Human Language Technology and Empirical Methods in Natural Language Processing (HLT-EMNLP), 2005, pp. 339–346. [29] Quan C., Ren F., Unsupervised product feature extraction for featureoriented opinion determination. Information Sciences, 272 (2014) 16– 28. [30] Thelwall M., Buckley K., Paltoglou G., Cai, D. & Kappas, A. (2010). Sentiment strength detection in short informal text. Journal of the American Society for Information Science and Technology, 61(12), 2544–2558. [31] Wiebe J., Wilson T., and Cardie C. (2005). Annotating expressions of opinions and emotions in language. Language Resources and Evaluation, volume 39, issue 2-3, pp. 165-210. [32] Wilson T., Wiebe J., and Hoffmann P. Recognizing contextual polarity in phrase-level sentiment analysis. In Proceedings of the Human Language Technology Conference and the Conference on Empirical Methods in Natural Language Processing (HLT/EMNLP), pages 347– 354, 2005. [33] 18 صفحة،كتاب "احياء النحو" ابراهيم مصطفى [34] http://ayaspell.blogspot.com/. Last accessed 19-May-2015. [35] http://arabicstopwords.sourceforge.net/. Last accessed 19-May-2015.