Ontology-based Textual Emotion Detection

—Emotion Detection from text is a very important area of natural language processing. This paper shows a new method for emotion detection from text which depends on ontology. This method is depending on ontology extraction from the input sentence by using a triplet extraction algorithm by the OpenNLP parser, then make an ontology matching with the ontology base that we created by similarity and word sense disambiguation. This ontology base consists of ontologies and the emotion label related to each one. We choose the emotion label of the sentence with the highest score of matching. If the extracted ontology doesn't match any ontology from the ontology base we use the keyword-based approach. This method doesn't depend only on keywords like previous approaches; it depends on the meaning of sentence words and the syntax and semantic analysis of the context.


INTRODUCTION
Textual analysis has many areas that have established standard methods and are also beneficial to emotion detection studies.Emotion detection is considered a newer area of textual analysis and therefore, has weaker standard methods.
Emotion detection of the text plays a key role in the human-computer interaction.People may express emotions by speech, facial and text emotion detection.There are a sufficient amount of work that has been done regarding facial and speech emotion detection, but text-based emotion detection system still needs attraction of researchers.In computational linguistics, the detection of human emotions in the text is becoming increasingly important from an applicative point of view.Automatic detection and classification of emotions has several potential areas of application such as sentiment analysis or opinion mining, market analysis, monitoring newsgroups and forums, affective computing, and natural language interfaces such as e-learning environments or educational/edutainment games.
Three approaches currently dominate the emotion detection task that will be discussed in the next section; Keyword based approach, Learning based approach, and Hybrid approach.This paper is structured as follows.The second section is related work that covers emotion theories; emotion labeled datasets, emotional lexicon, computational approaches of emotion detection and their limitations.The third section presents our proposed method.The fourth section is a case study.The fifth section discusses our results.The sixth section is a conclusion.

II. RELATED WORK
A. Emotion Theories Ekman, Izard, and Pultchick lists which are shown in table 1 are the most common lists of emotions used in emotion detection methods.Also there is a model which called OCC (Ortony/Clore/Collins) model.The OCC model presents emotions generally expressed by an agent.The OCC model includes 22 emotion categories [15] designed to model humans in general.It is based on the premise that emotions "are not themselves linguistic things, but the most readily available non phenomenal access we have to them is through language [15].

B. Emotion Labeled Datasets
Emotion labeled datasets are blocks of text that have been collected and annotated with emotion tags.It is very expensive and time consuming to annotate datasets manually.However, because the most stabilized method of checking the accuracy of an algorithm is comparing results to annotated text, annotated datasets have been established and consistently used throughout emotion detection studies.The most common annotated datasets are: SemEval 2007-Task [4] It is a common dataset used in many emotion detection studies for training or testing.It is an affective text that consists of newspaper headlines.This dataset multiple emotion tags for one sentence [11].The annotations are labeled with Ekman's six basic emotions (anger, disgust, fear, joy, sadness, and surprise) along with a neutral category.The dataset is composed of 1,250 annotated news titles, extracted from news web sites (such as Google news, CNN) and/or newspapers that is split between a training set of 250 headlines and a test set of 1,000 news headlines.

International Survey on Emotion Antecedents and Reactions (ISEAR)
It is an annotated dataset which is composed of 7.666 sentences provided by 1,096 participants with different cultures and from different countries and fields.They were www.ijacsa.thesai.orgquestioned about experiences and reactions that related to emotions of anger, disgust, fear, joy, sadness, and guilt.

Fairy Tales
Fairy tales is an emotion labeled dataset which is compiled of stories by the authors B. Potter, H. C. Anderson, & the Brothers Grimm.The stories are annotated at the sentencelevel.
A larger set of specific emotions is provided by varying annotation processes which have conducted by Alm.In 2005, a dataset labelled with Izard"s set of ten basic emotions which consists of 1580 sentences is compiled.In 2009, a dataset labelled with five emotion classes: angry-disgusted, fearful, happy, sad, and surprised is complied.

C. Emotional Lexicon
In the previous approaches of emotion detection discovering keywords or phrases that associated with emotions is the first step.These keywords and phrases are very important for training.Emotional lexicon is a list of emotions and words that express each emotion [20].The first step to make this lists is to identify the words that highly associate with one emotion, and expand by using synonyms.There are a few lexicons that generated a sufficient start.The most popular lexicons are: ANEW Word List (Affective Norms for English Words) [3] The ANEW list consists of a list of words scored within three emotional dimensions: pleasure, arousal and dominance, according to the SAM standard.

DAL Dictionary (Whissell's Dictionary of Affect
Language) [23] The DAL list contains 8742 words rated by people for their activation, evaluation and imagery.

LIWC Dictionary (Linguistic Inquiry and Word Count
Dictionary) [17] The LIWC dictionary provides a set of 2290 words and stems, classified in one or more categories, such as sadness, negative emotion or overall affect.
The use of words or stems, instead of concepts, as the primitive units, without recognizing the context in which the words are used is the main limitation of these lexicons.The lexicon which is on the contrary is: WordNet Affect database [22] The WordNet Affect Lexicon consists of 911 WordNet synsets labeled with a hierarchical set of emotional categories.It is a manually created collection of words.Each word is annotated with the emotion they evoke.The creation process involved annotating a few seed words or words that highly associate with one emotion with Ekman's six basic emotions then expanding the collection by using the WordNet synonyms of each word with the same emotion.The full list reached 1456 words.
Even though emotion lexicons is very important and growing it would be beneficial in detecting emotion, an annotated collection of words and phrases would only increase detection accuracy to a certain extent.In fact, most of the time emotion is not expressed through the use of words in emotion [1].The majority of words, or the synonyms of a word, fall under more than one emotional classifier [20].These words have unclear emotional meaning making the emotion label change by context or by the words surrounding it.

D. Computational Approaches for Emotion Detection
Currently there are three approaches dominating the emotion detection task; keyword based, learning based and hybrid based approach.In this section, the authors will provide a brief description of each of these approaches with particular emphasis on the pros and cons as presented in [7,8].

Keyword based approach
This approach depends on the presence of keywords and involves pre-processing with a parser and emotion dictionary.It is easy to implement and straight forward since it involves identifying words to search for in text.
This approach has been applied in chat systems by:  M. Chunling, H. Prendinger, and M. Ishizuka in [15].
This chat system displays emotion using an avatar.
 J. T. Hancock, C. Landrigan, and C. Silver in [14].They introduce a laboratory controlled online chat experiment to enact sadness and happiness and reporting strategies that people employ to express emotions in text.
 H. Li, N. Pang, and S. Guo in [12].They introduce the emotion detection incorporating personality factor in chatting system to improve accuracy.

Learning Based Approach
This approach uses a trained classifier for emotion detection task by using keywords as features.It can quickly learn new features from corpora by supplying a large training set to a machine learning algorithm for building a classification model; so it is easily and faster.This approach has been applied by:  C. Yang, K. H.-Y. Lin, and H.-H. Chen in [16].They introduced an emotion classification method from training at sentence level and applying at document level with sentence level contextual meaning.
 Z. Teng, F. Ren, and S. Kuroiwa in [25].They presented a recognition of Emotion method with SVMs (support vector machine).

Hybrid Approach
The hybrid approach is a combination of the keyword based implementation and learning based implementation.This approach can yield higher accuracy results from training a combination of classifiers and adding knowledge-rich linguistic information from dictionaries and thesauri.This approach has been applied by: www.ijacsa.thesai.org S. Aman and S. Szpakowicz in [18].They introduced an Emotion annotation task by category, intensity and word/phrase.
They presented a hybrid based architecture comprising of keyword based component and learning system component.
 C.-H. Wu, Z.-J.Chuang, and Y.-C.Lin in [6].They utilize a rule-based approach to extract semantics related to specific emotions, and Chinese lexicon ontology to extract attributes.These semantics and attributes are then associated with emotions in the form of emotion association rules.

Limitations in Current Approaches
From the above discussion there are few limitations:

Ambiguity in Keyword Definitions
Using emotion keywords isn"t the best way to detect associated emotions, every keyword could change its meaning according to different usages and contexts.The meanings of keywords could be multiple and vague, as most words could change their meanings according to different usages and contexts.

Incapability of Recognizing Sentences without Keywords
Keyword-based approach is totally based on emotion lexicons, so the emotion of sentences which doesn"t contain any emotion keyword can"t be detected.For example, "I passed my exam" and "Hooray!I passed my exam" should imply the same emotion (joy), but actually the emotion of the first simple can"t be detected by using the keyword-based approach because it doesn"t contain any emotion keyword like "hooray".

Lack of Linguistic Information
Syntax structures and semantics also affects the expressed emotions.For example, "I laughed at John" and "John laughed at me" would suggest different emotions from the first person's perspective.As a result, the keyword-based approach has a problem because of ignoring the linguistic information.

Difficulties in Determining Emotion Indicators [21]
Although learning-based methods can automatically determine the probabilities between features and emotions, it still need keywords as features, so this approach have the same problems of the keyword-based approach.

Over-simplified Emotion Categories
Nevertheless, the problems caused by using keywords as features, most learning-based methods classifies sentences into positive and negative categories only.

III. PROPOSED ARCHITECTURE
The main idea of our method is to extract ontology from input sentences and match it with our ontology base.This ontology base consists of the ontology relation between classes or objects (simple ontology) and its related emotion.
We make some pre-processing tasks on the input text and get the ontology relation(s) from the sentence, and then we make ontology matching between sentence relation(s) and our ontology base to get the emotion of the sentence.So by this method we put the sentence in a form which can be compared with others to get the similarity between sentences not based only on keywords but also its meaning of the words and the syntax and semantic analysis of the sentence.
You can find our proposed architecture at Fig. 1.If the new sentence ontology doesn"t match with any relation of our ontology base we use the keyword based approach.For the keyword based approach we use the WordNet affect database.

A. Pre-processing
There are some steps must be done to the input text to extract the ontology from sentences.These steps are: Sentence detecting: Is to convert our input text into sentences.
Parsing: To break a sentence down into its component parts of speech with an explanation of the form, function, and syntactical relationship of each part.
Sentence splitting: Is the process of converting the compound and complex sentence into simple sentences.

Example for sentence splitting:
John plays football, but Jack plays basketball.The result will be two separated simple sentence: www.ijacsa.thesai.org

B. Ontology Extraction Sentence Triplet Extraction
Our method for extracting ontology relations or simple ontologies from sentence is based on sentence triplet extraction (subject, predicate, and object).Which means that the subject will be the first class or individual, the object will be the second one and the predicate will be the relation between them.Delia Rusu*, Lorand Dali*, Blaž Fortuna°, Marko Grobelnik°, & Dunja Mladenić, 2007 presented in [8] four different well known syntactical parsers for English for generating parse trees from the sentences, followed by extracting the triplets from the parse trees.They are the Stanford parser, OpenNLP parser, Link parser, and MINIPAR parsers.They made a comparison between them and proved that the OpenNLP parser is the best.So authors use the OpenNLP parser; In OpenNLP parser a sentence (S) is represented by the parser as a tree; each tree having three children: a noun phrase (NP), a verbal phrase (VP) and the full stop (.).The root of the tree will be S.
Firstly, the subject can be found by performing breadth first search and selecting the first descendent of the NP subtree that is a noun.Secondly, for determining the predicate of the sentence and checking for negation, for searching for the predicate and negation check a search will be performed in the VP subtree.The verb can be found by finding the deepest verb descendent of the verb phrase.Thirdly, objects can be found in three different subtrees, all siblings of the VP subtree containing the predicate.They are: (prepositional phrase), NP and ADJP (adjective phrase).In NP and PP the object can be found by searching for the first noun, while in the ADJP by searching for the first adjective.After that we get the attributes of each element of the triplet using the algorithm in Fig. 2 which is mentioned in [8].
You can find OpenNLP Part-of-Speech (POS) Tags in table 2.

Named Entity Recognition (NER)
After ontology extraction using triplet extraction we make the Named entity recognition subtask for each element in our ontology which seeks to locate and classify elements in text into pre-defined categories such as the names of persons, organizations, locations, expressions of times, quantities, monetary values, percentages, etc.

Stop Words Handling
It is the process of removing the stop words from the ontology elements to decrease the execution time for the next steps.

C. Ontology Matching
Ontology matching is the process of finding the similarity between the first classes of the two simple ontologies, the two relations of the two ontologies, and the second classed of them, then we get the score of the ontology matching between the two ontologies.For calculating the similarity we use the Wu & Palmer measure.wup finds the depth of the LCA depth of the concepts, and then scales that by the sum of the depths of the individual concepts.We use the WordNet 2.1 to get it.Before we get the similarity between any pair of them we get the meaning (sense) of each word by using the Lesk algorithm to get more accurate similarity.We make ontology matching with all ontologies in the ontology base, and we get the emotion of the one with the best score of similarity.
Example of ontology matching shown in Fig. 3.
This figure shows two simple ontologies .To make ontology matching between them we get the semantic similarity between "author" and "illustrator", "write" and "compose", and "story" and "report".

D. Keyword Based Approach
In our keyword based approach we use WordNet affect database.Firstly we make tokenization, POS tagging, stop words handling, and then get the similarity of each token with keywords in the WordNet affect database instead of depending on the appearance of the keywords.www.ijacsa.thesai.orgAnd the sentence to test is: John shoot the customers.
Steps will be as follow: A. Pre-processing -Sentence splitting: John shoot the customers.

B. Ontology Extraction
The result of ontology extraction from sentence shown in Table 4.
We choose the highest score and at the same time the similarity with each ontology element isn"t less than 0.5.
In this case the best score is 0.81 which is for sentence 2, so the emotion of the sentence will be (Fear), and then add this new relation in our ontology base.But if there is no matching then we apply our keyword based approach.

V. EXPERIMENTAL RESULTS
Our testing will be at the sentence level.For training we create a data set of 511 sentences which are similar in meaning of 511 newspapers headlines of the SemEval dataset which are complete sentences with the help of online dictionaries, and make our training on these new headline to create our ontology base.This ontology base contains 31 ontologies which have "anger" emotion, 14 have "disgust" emotion, 75 have "fear" emotion, 120 have "sadness" emotion, 83 have "surprise" emotion, 188 have joy emotion.
We made our testing on the SemEval dataset.Like most emotional detection approaches, results are presented with the common measures of precision, recall, and f-score.Precision is the number of relevant instances retrieved by the given algorithm over the total number of instances retrieved by the algorithm.In this case, precision is the number of correctly labeled sentences retrieved by the algorithm divided by all the sentences retrieved by the algorithm.Recall is the number of relevant instances retrieved by the given algorithm over the total number that should have been returned.In this study, recall is the number of correctly labeled sentences retrieved by the algorithm divided by all the sentences annotated as correct.After precision and recall are calculated, we multiply them by 100 then the values are used to calculate the f-score, or the harmonic mean of precision and recall that functions as a weighted average equation.You can find the f-score equation in (1):  In all measures, 100.0 is the highest value and 0.0 the lowest.
For example, When a search engine returns 30 pages only 20 of which were relevant while failing to return 40 additional relevant pages, its precision is (20/30 )*100= 66.67 while its recall is (20/60) * 100 = 33.33 Results are shown in Table 8.We compare our results with those obtained in [7] which have implemented five different systems for emotion analysis: WN-Affect Presence, which is used as a baseline system, and which annotates the emotions in a text simply based on the appearance of words from the Word-Net Affect lexicon.
LSA Single Word, which calculates the latent semantic analysis similarity between the given text and each emotion, each emotion is represented as the vector of the specific word denoting the emotion (e.g., anger).
LSA Emotion Synset, which calculates the latent semantic analysis similarity between the given text and each emotion synset, where in addition to the word denoting an emotion, its synonyms from the WordNet synset are also used.LSA all Emotion Words, which increases the previous set by adding the words in all the synsets labeled with a given emotion, as found in WordNet Affect.NB Trained on Blogs, which uses a Naive Bayes classifier trained on the blog data annotated for emotions.That paper also compare their results with those obtained by three systems participating in the Semeval emotion annotation task: SWAT, UPAR7 and UA.The authors briefly describe below each of the three systems: UPAR [10]: It is a rule-based system.Uncapitalizes common words in the news titles is the first pass through the data.The system then identifies what is being said about the main subject by exploiting the dependency graph of the modified title obtained from the Stanford syntactic parser.The system then rate each word separately for each emotion and then the main subject rating is boosted.The system uses a combination of WordNet Affect and SentiWordNet [2], which were semi-automatically enriched on the basis of the original trial data provided during the Semeval task.
UA [24]: This system determines the kind and the amount of emotion in each headline by using statistics gathered from three search engines.The emotion scores are obtained through Pointwise Mutual Information (PMI).First, the number of documents obtained from the three web search engines by using a query that contains all the words of the headline and an emotion (the words occur in an independent proximity across the Web documents) is divided by the number of documents containing only an emotion and the number of documents containing all the headline words.Second, the system estimates an associative score between each content word and an emotion and then uses it to weight the final PMI score.Then normalizes the final results to the 0-100 range.
SWAT [5]: This system is a supervised system which annotates emotional content by using a unigram model, then performs synonym expansion on the emotion label words, using the Roget Thesaurus.
The SWAT team annotated an additional set of 1000 headlines, in addition to the development data provided by the task organizers.They used these 1000 sentences for training.
The results of the three systems shown in Table 8. +The overall average results obtained by our system and all the other systems shown in Table 9. Best results shown in bold.We show that our system has the best results in precision, and F-score.LSA all emotion words has the best result in recall.
Our results in recall can be better if the number of ontologies extracted from sentences that matches our ontology base increased.That can be achieved by making an ontology base for each domain separately e.g.medical, sport, tourism, and so on.www.ijacsa.thesai.org

VI. CONCLUSION
Emotion detection has a promising future.Although not enough time has passed to have established standards in the field, there is some consistency between the approaches, and the algorithms are continuing to increase in accuracy.This paper describes a new method for emotion detection from the text by ontology extraction from sentences, ontology matching with our ontology base that consists of ontologies and the related emotion for each one.This method provides syntax and semantic analysis of the context and provides the meaning of words.We show our results of testing on the SemEval dataset, and compare our results with different results that were implemented by Carlo Strapparava and Rada Mihalcea in 2008.We show that our system has the best results in precision and F-score.

Sentence 1 =
John plays football.And Sentence 2 = Jack plays basketball.

Fig. 2 .
Fig. 2. The algorithm for extracting the attributes of the triplet in treebank output

TABLE II .
OPENNLP POS TAGS

TABLE III .
EXAMPLE OF SIMPLE ONTOLOGY BASE

TABLE IV .
ONTOLOGY EXTRACTION RESULT FROM SENTENCE

TABLE VI .
OUR RESULTS

TABLE VII .
RESULTS OF THE FIVE SYSTEMS

TABLE VIII .
RESULTS OF THE SYSTEMS PARTICIPATING IN THE SEMEVAL TASK -EMOTION ANNOTATIONS

TABLE IX .
OVERALL AVERAGE RESULTS