A Topic Model for Building Fine-grained Domain-specific Emotion Lexicon

[    [    [    [    [

Emotion lexicons play a crucial role in sentiment analysis and opinion mining. In this paper, we propose a novel Emotion-aware LDA (EaLDA) model to build a domain-specific lexicon for predefined emotions that include anger, disgust, fear, joy, sadness, surprise. The model uses a minimal set of domain-independent seed words as prior knowledge to discover a domain-specific lexicon, learning a fine-grained emotion lexicon much richer and adaptive to a specific domain. By comprehensive experiments, we show that our model can generate a high-quality fine-grained domain-specific emotion lexicon.

‡]MinYang§]BaolinPeng§]ZhengChen†,¶]DingjuZhuthanks: DingjuZhuisthecorrespondingauthor‡]Kam-PuiChow\affil[†]SchoolofComputerScience,SouthChinaNormalUniversity,Guangzhou,China\affil[]dingjuzhu@gmail.com\affil[‡]DepartmentofComputerScience,TheUniversityofHongKong,HongKong\affil[]{myang,chow}@cs.hku.hk\affil[§]DepartmentofComputerScience,BeihangUniversity,Beijing,China\affil[]b.peng@cse.buaa.edu.cn,tzchen86@gmail.com\affil[¶]ShenzhenInstitutesofAdvancedTechnology,ChineseAcademyofSciences,Shenzhen,China



1 Introduction

Due to the popularity of opinion-rich resources (e.g., online review sites, forums, blogs and the microblogging websites), automatic extraction of opinions, emotions and sentiments in text is of great significance to obtain useful information for social and security studies. Various opinion mining applications have been proposed by different researchers, such as question answering, opinion mining, sentiment summarization, etc. As the fine-grained annotated data are expensive to get, the unsupervised approaches are preferred and more used in reality. Usually, a high quality emotion lexicon play a significant role when apply the unsupervised approaches for fine-grained emotion classification.

Thus far, most lexicon construction approaches focus on constructing general-purpose emotion lexicons [11, 7, 16, 4]. However, since a specific word can carry various emotions in different domains, a general-purpose emotion lexicon is less accurate and less informative than a domain-specific lexicon [1]. In addition, in previous work, most of the lexicons label the words on coarse-grained dimensions (positive, negative and neutrality). Such lexicons cannot accurately reflect the complexity of human emotions and sentiments. Lastly, previous emotion lexicons are mostly annotated based on many manually constructed resources (e.g., emotion lexicon, parsers, etc.). This limits the applicability of these methods to a broader range of tasks and languages.

To meet the challenges mentioned above, we propose a novel EaLDA model to construct a domain-specific emotion lexicon consisting of six primary emotions (i.e., anger, disgust, fear, joy, sadness and surprise). The proposed EaLDA model extends the standard Latent Dirichlet Allocation (LDA) [3] model by employing a small set of seeds to guide the model generating topics. Hence, the topics consequently group semantically related words into a same emotion category. The lexicon is thus able to best meet the user’s specific needs. Our approach is a weakly supervised approach since only some seeds emotion sentiment words are needed to lanch the process of lexicon construction. In practical applications, asking users to provide some seeds is easy as they usually have a good knowledge what are important in their domains.

Extensive experiments are carried out to evaluate our model both qualitatively and quantitatively using benchmark dataset. The results demonstrate that our EaLDA model improves the quality and the coverage of state-of-the-art fine-grained lexicon.

2 Related Work

Emotion lexicon plays an important role in opinion mining and sentiment analysis. In order to build such a lexicon, many researchers have investigated various kinds of approaches. However, these methods could roughly be classified into two categories in terms of the used information. The first kind of approaches is based on thesaurus that utilizes synonyms or glosses to determine the sentiment orientation of a word. The availability of the WordNet [9] database is an important starting point for many thesaurus-based approaches [8, 7, 5]. The second kind of approaches is based on an idea that emotion words co-occurring with each others are likely to convey the same polarity. There are numerous studies in this field [14, 15, 5, 2].

Most of the previous studies for emotion lexicon construction are limited to positive and negative emotions. Recently, to enhance the increasingly emotional data, a few researches have been done to identity the fine-grained emotion of words [12, 6, 10]. For example, Gill et al. (2008) utilize computational linguistic tools to identity the emotions of the words (such as, joy, sadness, acceptance, disgust, fear, anger, surprise and anticipation). While, this approach is mainly for public use in general domains. Rao et al. (2012) propose an method of automatically building the word-emotion mapping dictionary for social emotion detection. However, the emtion lexicon is not outputed explicitly in this paper, and the approach is fully unsupervised which may be difficult to be adjusted to fit the personalized data set.

Our approach relates most closely to the method proposed by Xie and Li (2012) for the construction of lexicon annotated for polarity based on LDA model. Our approach differs from [17] in two important ways: first, we do not address the task of polarity lexicon construction, but instead we focus on building fine-grained emotion lexicon. Second, we don’t assume that every word in documents is subjective, which is impractical in real world corpus.

3 Algorithm

In this section, we rigorously define the emotion-aware LDA model and its learning algorithm. We descrige with the model description, a Gibbs sampling algorithm to infer the model parameters, and finally how to generate a emotion lexicon based on the model output.

3.1 Model Description

Like the standard LDA model, EaLDA is a generative model. To prevent conceptual confusion, we use a superscript “(e)” to indicate variables related to emotion topics, and use a superscript “(n)” to indicate variables of non-emotion topics. We assume that each document has two classes of topics: M emotion topics (corresponding to M different emotions) and K non-emotion topics (corresponding to topics that are not associated with any emotion). Each topic is represented by a multinomial distribution over words. In addition, we assume that the corpus vocabulary consists of V distinct words indexed by {1,,V}.

For emotion topics, the EaLDA model draws the word distribution from a biased Dirichlet prior Dir(βk(e)). The vector βk(e)V is constructed with βk(e):=γ0(e)(1V-Ωk)+γ1(e)Ωk, for k{1,,M}. Ωk,w=1 if and only if word w is a seed word for emotion k, otherwise Ωk,w=0. The scalars γ0(e) and γ1(e) are hyperparameters of the model. Intuitively, when γ1(e)>γ0(e), the biased prior ensures that the seed words are more probably drawn from the associated emotion topic.

The generative process of word distributions for non-emotion topics follows the standard LDA definition with a scalar hyperparameter β(n).

For each word in the document, we decide whether its topic is an emotion topic or a non-emotion topic by flipping a coin with head-tail probability (p(e),p(n)), where (p(e),p(n))Dir(α). The emotion (or non-emotion) topic is sampled according to a multinomial distribution Mult(θ(e)) (or Mult(θ(n))). Here, both θ(e) and θ(n) are document-level latent variables. They are generated from Dirichlet priors Dir(α(e)) and Dir(α(n)) with α(s) and α(n) being hyperparameters.

We summarize the generative process of the EaLDA model as below:

  1. 1.

    for each emotion topic k{1,,M}, draw ϕk(e)Dir(βk(e))

  2. 2.

    for each non-emotion topic k{1,,K}, draw ϕk(n)Dir(β(n))

  3. 3.

    for each document

    1. (a)

      draw θ(e)Dir(α(e))

    2. (b)

      draw θ(n)Dir(α(n))

    3. (c)

      draw (p(e),p(n))Dir(α)

    4. (d)

      for each word in document

      1. i.

        draw topic class indicator sBernoulli(ps)

      2. ii.

        if s=“emotion topic”

        1. A.

          draw z(e)Mult(θ(e))

        2. B.

          draw wMult(ϕz(e)(e)) , emit word w

      3. iii.


        1. A.

          draw z(n)Mult(θ(n))

        2. B.

          draw wMult(ϕz(n)(n)) , emit word w

As an alternative representation, the graphical model of the the generative process is shown by Figure 1.






















Figure 1: The Emotion-aware LDA model.

3.2 Inference Algorithm

Assuming hyperparameters α, α(e), α(n), and β(e), β(n), we develop a collapsed Gibbs sampling algorithm to estimate the latent variables in the EaLDA model. The algorithm iteratively takes a word w from a document and sample the topic that this word belongs to.

Let the whole corpus excluding the current word be denoted by D. Let ni,w(e) (or nj,w(n)) indicate the number of occurrences of topic i(e) (or topic j(n)) with word w in the whole corpus. Let mi(e) (or mj(n)) indicate the number of occurrence of topic i(e) (or topic j(n)) in the current document. All these counts are defined excluding the current word. Using the definition of the EaLDA model and the Bayes Rule, we find that the joint density of these random variables are equal to

j=1Kw=1V(ϕj,w(n))β(n)+nj,w(n)-1 (1)

According to equation (1), we see that {p(e),p(n)}, {θi(e),θj(n)}, {ϕi,w(e)} and {ϕj,w(n)} are mutually independent sets of random variables. Each of these random variables satisfies Dirichlet distribution with a specific set of parameters. By the mutual independence, we decompose the probability of the topic z for the current word as

Pr(z=i(e)|D)𝔼[p(e)]𝔼[θi(e)]𝔼[ϕi,w(e)] (2)
Pr(z=j(n)|D)𝔼[p(n)]𝔼[θi(n)]𝔼[ϕj,w(n)] (3)

Then, by examining the property of Dirichlet distribution, we can compute expectations on the right hand side of equation (2) and equation (3) by

𝔼[p(e)] = α+i=01mi(e)2α+i=1Mmi(e)+j=1Kmj(n) (4)
𝔼[p(n)] = α+j=1Kmj(n)2α+i=1Mmi(e)+j=1Kmj(n) (5)
𝔼[θi(e)] = α(e)+mi(e)Mα(e)+i=1Mmi(e) (6)
𝔼[θj(n)] = α(e)+mj(n)Kα(n)+j=1Kmj(n) (7)
𝔼[ϕi,w(e)] = βi,w(e)+ni,w(e)w=1V(βi,w(e)+ni,w(e)) (8)
𝔼[ϕj,w(n)] = βj,w(n)+nj,w(n)Vβ(n)+w=1Vnj,w(n) (9)

Using the above equations, we can sample the topic z for each word iteratively and estimate all latent random variables.

3.3 Constructing Emotion Lexicon

Our final step is to construct the domain-specific emotion lexicon from the estimates ϕ(e) and ϕ(n) that we obtained from the EaLDA model.

For each word w in the vocabulary, we compare the M+1 values {ϕ1,w(e),,ϕM,w(e)} and 1Ki=1Kϕi,w(n). If ϕi,w(e) is the largest, then the word w is added to the emotion dictionary for the ith emotion. Otherwise, 1Ki=1Kϕi,w(n) is the largest among the M+1 values, which suggests that the word w is more probably drawn from a non-emotion topic. Thus, the word is considered neutral and not included in the emotion dictionary.

Anger Disgust Fear Joy Sadness Surprise
attack mar terror good kill surprise
warn sex troop win die first
gunman lebanon flu prize kidnap jump
baghdad game dead victory lose marijuana
immigration gaze die adopt confuse arrest
hit cancer cancer madonna crach sweat
kidnap amish kidnap celebrity leave find
kill imigration force boost cancer attack
alzheim sink iraq ship flu hiv
iraqi force fear star kidnap discover
Table 1: Part of Emotion example words
Algorithm Anger Disgust Fear Joy Sadness Surprise
WordNet-Affect 6.06% - - 22.81% 17.31% 9.92%
SWAT 7.06% - 18.27% 14.91% 17.44% 11.78%
UA 16.03% - 20.06% 4.21% 1.76% 15.00%
UPAR7 3.02% - 4.72% 11.87% 17.44% 15.00%
EaLDA 16.65% 10.52% 26.21% 25.57% 36.85% 20.17%
Table 2: Experiment results for emotion classification in term of F1 score

4 Experiments

In this section, we report empirical evaluations of our proposed model. Since there is no metric explicitly measuring the quality of an emotion lexicon, we demonstrate the performance of our algorithm in two ways: (1) we perform a case study for the lexicon generated by our algorithm, and (2) we compare the results of solving emotion classification task using our lexicon against different methods, and demonstrate the advantage of our lexicon over other lexicons and other emotion classification systems.

4.1 Datasets

We conduct experiments to evaluate the effectiveness of our model on SemEval-2007 dataset. This is an gold-standard English dataset used in the 14th task of the SemEval-2007 workshop which focuses on classification of emotions in the text. The attributes include the news headlines, the score of emotions of anger, disgust, fear, joy, sad and surprise normalizing from 0 to 100. Two data sets are available: a training data set consisting of 250 records, and a test data set with 1000 records. Following the strategy used in [12], the task was carried out in an unsupervised setting for experiments.

In experiments, data preprocessing is performed on the data set. First, the texts are tokenized with a natural language toolkit NLTK11http://www.nltk.org. Then, we remove non-alphabet characters, numbers, pronoun, punctuation and stop words from the texts. Finally, Snowball stemmer22http://snowball.tartarus.org/ is applied so as to reduce the vocabulary size and settle the issue of data spareness.

4.2 Emotion Lexicon Construction

We first settle down the implementation details for the EaLDA model, specifying the hyperparameters that we choose for the experiment. We set topic number M=6, K=4, and hyperparameters α=0.75, α(e)=α(n)=0.45, β(n)=0.5. The vector β(e) is constructed from the seed dictionary using γ=(0.25,0.95).

As mentioned, we use a few domain-independent seed words as prior information for our model. To be specific, the seed words list contains 8 to 12 emotional words for each of the six emotion categories.33http://minyang.me/acl2014/seed-words.html However, it is important to note that the proposed models are flexible and do not need to have seeds for every topic.

Example words for each emotion generated from the SemEval-2007 dataset are reported in Table 1. The judgment is to some extent subjective. What we reported here are based on our judgments what are appropriate and what are not for each emotion topic. From Table 1, we observe that the generated words are informative and coherent. For example, the words “flu” and “cancer” are seemingly neutral by its surface meaning, actually expressing fear emotion for SemEval dataset. These domain-specific words are mostly not included in any other existing general-purpose emotion lexicons. The experimental results show that our algorithm can successfully construct a fine-grained domain-specific emotion lexicon for this corpus that is able to understand the connotation of the words that may not be obvious without the context.

4.3 Document-level Emotion Classification

We compare the performance between a popular emotion lexicon WordNet-Affect [13] and our approach for emotion classification task. We also compare our results with those obtained by three systems participating in the SemEval-2007 emotion annotation task: SWAT, UPAR7 and UA. The emotion classification results is evaluated for each emotion category separately. For each emotion category, we evaluates it as a binary classification problem. In the evaluation of emotion lexicons, the binary classification is performed in a very simple way. For each emotion category and each text, we compare the number of words within this emotion category, and the average number of words within other emotion categories, to output a binary prediction of 1 or 0. This simple approach is chosen to evaluate the robustness of our emotion lexicon.

In the experiments, performance is evaluated in terms of F1-score. We summarize the results in Table 2. As an easy observation, the emotion lexicon generated by the EaLDA model consistently and significantly outperforms the WordNet-Affect emotion lexicon and other three emotion classification systems. In particular, we are able to obtain an overall F1-score of 10.52% for disgust classification task which is difficult to work out using previously proposed methods. The advantage of our model may come from its capability of exploring domain-specific emotions which include not only explicit emotion words, but also implicit ones.

5 Conclusions and Future Work

In this paper, we have presented a novel emotion-aware LDA model that is able to quickly build a fine-grained domain-specific emotion lexicon for languages without many manually constructed resources. The proposed EaLDA model extends the standard LDA model by accepting a set of domain-independent emotion words as prior knowledge, and guiding to group semantically related words into the same emotion category. Thus, it makes the emotion lexicon containing much richer and adaptive domain-specific emotion words. Experimental results showed that the emotional lexicons generated by our algorithm is of high quality, and can assist emotion classification task.

For future works, we hope to extend the proposed EaLDA model by exploiting discourse structure knowledge, which has been shown significant in identifying the polarity of content-aware words.


  • [1] S. Baccianella, A. Esuli and F. Sebastiani(2010) SentiWordNet 3.0: an enhanced lexical resource for sentiment analysis and opinion mining.. Vol. 10, pp. 2200–2204. Cited by: 1.
  • [2] L. Barbosa and J. Feng(2010) Robust sentiment detection on twitter from biased and noisy data. pp. 36–44. Cited by: 2.
  • [3] D. M. Blei, A. Y. Ng and M. I. Jordan(2003) Latent dirichlet allocation. the Journal of machine Learning research 3, pp. 993–1022. Cited by: 1.
  • [4] Z. Dong and Q. Dong(2006) HowNet and the computation of meaning. World Scientific. Cited by: 1.
  • [5] A. Esuli and F. Sebastiani(2006) Sentiwordnet: a publicly available lexical resource for opinion mining. Vol. 6, pp. 417–422. Cited by: 2.
  • [6] A. J. Gill, R. M. French, D. Gergle and J. Oberlander(2008) The language of emotion in short blog texts.. Vol. 8, pp. 299–302. Cited by: 2.
  • [7] M. Hu and B. Liu(2004) Mining and summarizing customer reviews. pp. 168–177. Cited by: 1, 2.
  • [8] J. Kamps, M. Marx, R. J. Mokken and M. De Rijke(2004) Using wordnet to measure semantic orientations of adjectives. Cited by: 2.
  • [9] G. A. Miller(1995) WordNet: a lexical database for english. Communications of the ACM 38 (11), pp. 39–41. Cited by: 2.
  • [10] Y. Rao, X. Quan, L. Wenyin, Q. Li and M. Chen(2012) Building word-emotion mapping dictionary for online news. pp. 28. Cited by: 2.
  • [11] P. J. Stone, D. C. Dunphy and M. S. Smith(1966) The general inquirer: a computer approach to content analysis.. Cited by: 1.
  • [12] C. Strapparava and R. Mihalcea(2007) Semeval-2007 task 14: affective text. pp. 70–74. Cited by: 2, 4.1.
  • [13] C. Strapparava and A. Valitutti(2004) WordNet affect: an affective extension of wordnet.. Vol. 4, pp. 1083–1086. Cited by: 4.3.
  • [14] P. D. Turney and M. L. Littman(2003) Measuring praise and criticism: inference of semantic orientation from association. ACM Transactions on Information Systems (TOIS) 21 (4), pp. 315–346. Cited by: 2.
  • [15] J. Wiebe and E. Riloff(2005) Creating subjective and objective sentence classifiers from unannotated texts. Computational Linguistics and Intelligent Text Processing, pp. 486–497. Cited by: 2.
  • [16] T. Wilson, J. Wiebe and P. Hoffmann(2005) Recognizing contextual polarity in phrase-level sentiment analysis. pp. 347–354. Cited by: 1.
  • [17] R. Xie and C. Li(2012) Lexicon construction: a topic model approach. pp. 2299–2303. Cited by: 2.