SlowGuess/ACL_2020_OCR huggingface dataset:
Dorottya Demszky $^{1*}$  Dana Movshovitz-Attias $^{2}$  Jeongwoo Ko $^{2}$  Alan Cowen $^{2}$  Gaurav Nemade $^{2}$  Sujith Ravi $^{3*}$
1Stanford Linguistics 2Google Research 3Amazon Alexa
ddemszky@stanford.edu
{danama, jko, acowen, gnemade}@google.com
sravi@sravi.org
Understanding emotion expressed in language has a wide range of applications, from building empathetic chatbots to detecting harmful online behavior. Advancement in this area can be improved using large-scale datasets with a fine-grained typology, adaptable to multiple downstream tasks. We introduce GoEmotions, the largest manually annotated dataset of 58k English Reddit comments, labeled for 27 emotion categories or Neutral. We demonstrate the high quality of the annotations via Principal Preserved Component Analysis. We conduct transfer learning experiments with existing emotion benchmarks to show that our dataset generalizes well to other domains and different emotion taxonomies. Our BERT-based model achieves an average F1-score of .46 across our proposed taxonomy, leaving much room for improvement. $^{1}$
Emotion expression and detection are central to the human experience and social interaction. With as many as a handful of words we are able to express a wide variety of subtle and complex emotions, and it has thus been a long-term goal to enable machines to understand affect and emotion (Picard, 1997).
In the past decade, NLP researchers made available several datasets for language-based emotion classification for a variety of domains and applications, including for news headlines (Strapparava and Mihalcea, 2007), tweets (CrowdFlower, 2016; Mohammad et al., 2018), and narrative sequences (Liu et al., 2019), to name just a few. However, existing available datasets are (1) mostly small, containing up to several thousand instances, and (2) cover a limited emotion taxonomy, with coarse clas
Sample Text	Label(s)
OMG, yup!!! That is the final answer. Thank you so much!	gratitude, approval
I'm not even sure what it is, why do people hate it	confusion
Guilty of doing this tbph	remorse
This caught me off guard for real. I'm actually off my bed laughing	surprise, amusement
I tried to send this to a friend but [NAME] knocked it away.	disappointment
Table 1: Example annotations from our dataset.
sification into Ekman (Ekman, 1992b) or Plutchik (Plutchik, 1980) emotions.
Recently, Bostan and Klinger (2018) have aggregated 14 popular emotion classification corpora under a unified framework that allows direct comparison of the existing resources. Importantly, their analysis suggests annotation quality gaps in the largest manually annotated emotion classification dataset, CrowdFlower (2016), containing 40K tweets labeled for one of 13 emotions. While their work enables such comparative evaluations, it highlights the need for a large-scale, consistently labeled emotion dataset over a fine-grained taxonomy, with demonstrated high-quality annotations.
To this end, we compiled GoEmotions, the largest human annotated dataset of 58k carefully selected Reddit comments, labeled for 27 emotion categories or Neutral, with comments extracted from popular English subreddits. Table 1 shows an illustrative sample of our collected data. We design our emotion taxonomy considering related work in psychology and coverage in our data. In contrast to Ekman's taxonomy, which includes only one positive emotion (joy), our taxonomy includes a large number of positive, negative, and ambiguous emotion categories, making it suitable for downstream
* Work done while at Google Research.  
<sup>1</sup>Data and code available at https://github.com/google-research/google-research/tree/ster/goemotions.
Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4040-4054 July 5 - 10, 2020. ©2020 Association for Computational Linguistics
conversation understanding tasks that require a subtle understanding of emotion expression, such as the analysis of customer feedback or the enhancement of chatbots.
We include a thorough analysis of the annotated data and the quality of the annotations. Via Principal Preserved Component Analysis (Cowen et al., 2019b), we show a strong support for reliable dissociation among all 27 emotion categories, indicating the suitability of our annotations for building an emotion classification model.
We perform hierarchical clustering on the emotion judgments, finding that emotions related in intensity cluster together closely and that the top-level clusters correspond to sentiment categories. These relations among emotions allow for their potential grouping into higher-level categories, if desired for a downstream task.
We provide a strong baseline for modeling fine-grained emotion classification over GoEmotions. By fine-tuning a BERT-base model (Devlin et al., 2019), we achieve an average F1-score of .46 over our taxonomy, .64 over an Ekman-style grouping into six coarse categories and .69 over a sentiment grouping. These results leave much room for improvement, showcasing this task is not yet fully addressed by current state-of-the-art NLU models.
We conduct transfer learning experiments with existing emotion benchmarks to show that our data can generalize to different taxonomies and domains, such as tweets and personal narratives. Our experiments demonstrate that given limited resources to label additional emotion classification data for specialized domains, our data can provide baseline emotion understanding and contribute to increasing model accuracy for the target domain.
2.1 Emotion Datasets
Ever since Affective Text (Strapparava and Mihalcea, 2007), the first benchmark for emotion recognition was introduced, the field has seen several emotion datasets that vary in size, domain and taxonomy (cf. Bostan and Klinger, 2018). The majority of emotion datasets are constructed manually, but tend to be relatively small. The largest manually labeled dataset is CrowdFlower (2016), with 39k labeled examples, which were found by Bostan and Klinger (2018) to be noisy in comparison with other emotion datasets. Other datasets are automatically weakly-labeled, based on emotion-related
haftags on Twitter (Wang et al., 2012; AbdulMageed and Ungar, 2017). We build our dataset manually, making it the largest human annotated dataset, with multiple annotations per example for quality assurance.
Several existing datasets come from the domain of Twitter, given its informal language and expressive content, such as emojis and hashtags. Other datasets annotate news headlines (Strapparava and Mihalcea, 2007), dialogs (Li et al., 2017), fairytales (Alm et al., 2005), movie subtitles (Ohman et al., 2018), sentences based on FrameNet (Ghazi et al., 2015), or self-reported experiences (Scherer and Wallbott, 1994) among other domains. We are the first to build on Reddit comments for emotion prediction.
2.2 Emotion Taxonomy
One of the main aspects distinguishing our dataset is its emotion taxonomy. The vast majority of existing datasets contain annotations for minor variations of the 6 basic emotion categories (joy, anger, fear, sadness, disgust, and surprise) proposed by Ekman (1992a) and/or along affective dimensions (valence and arousal) that underpin the circumplex model of affect (Russell, 2003; Buechel and Hahn, 2017).
Recent advances in psychology have offered new conceptual and methodological approaches to capturing the more complex "semantic space" of emotion (Cowen et al., 2019a) by studying the distribution of emotion responses to a diverse array of stimuli via computational techniques. Studies guided by these principles have identified 27 distinct varieties of emotional experience conveyed by short videos (Cowen and Keltner, 2017), 13 by music (Cowen et al., in press), 28 by facial expression (Cowen and Keltner, 2019), 12 by speech prosody (Cowen et al., 2019b), and 24 by nonverbal vocalization (Cowen et al., 2018). In this work, we build on these methods and findings to devise our granular taxonomy for text-based emotion recognition and study the dimensionality of language-based emotion space.
2.3 Emotion Classification Models
Both feature-based and neural models have been used to build automatic emotion classification models. Feature-based models often make use of hand-built lexicons, such as the Valence Arousal Dominance Lexicon (Mohammad, 2018). Using representations from BERT (Devlin et al., 2019), a
transformer-based model with language model pretraining, has recently shown to reach state-of-the-art performance on several NLP tasks, also including emotion prediction: the top-performing models in the EmotionX Challenge (Hsu and Ku, 2018) all employed a pre-trained BERT model. We also use the BERT model in our experiments and we find that it outperforms our biLSTM model.
3 GoEmotions
Our dataset is composed of 58K Reddit comments, labeled for one or more of 27 emotion(s) or Neutral.
3.1 Selecting & Curating Reddit comments
We use a Reddit data dump originating in the reddit-data-tools project<sup>2</sup>, which contains comments from 2005 (the start of Reddit) to January 2019. We select subreddits with at least 10k comments and remove deleted and non-English comments.
Reddit is known for a demographic bias leaning towards young male users (Duggan and Smith, 2013), which is not reflective of a globally diverse population. The platform also introduces a skew towards toxic, offensive language (Mohan et al., 2017). Thus, Reddit content has been used to study depression (Pirina and Cöltekin, 2018), microaggressions (Breitfeller et al., 2019), and Yanardag and Rahwan (2018) have shown the effect of using biased Reddit data by training a "psychopath" bot. To address these concerns, and enable building broadly representative emotion models using GoEmotions, we take a series of data curation measures to ensure our data does not reinforce general, nor emotion-specific, language biases.
We identify harmful comments using pre-defined lists containing offensive/adult, vulgar (mildly offensive profanity), identity, and religion terms (included as supplementary material). These are used for data filtering and masking, as described below. Lists were internally compiled and we believe they are comprehensive and widely useful for dataset curation, however, they may not be complete.
Reducing profanity. We remove subreddits that are not safe for work<sup>3</sup> and where  $10\%+$  of comments include offensive/adult and vulgar tokens. We remove remaining comments that include offensive/adult tokens. Vulgar comments are preserved as we believe they are central to learning about
negative emotions. The dataset includes the list of filtered tokens.
Manual review. We manually review identity comments and remove those offensive towards a particular ethnicity, gender, sexual orientation, or disability, to the best of our judgment.
Length filtering. We apply NLTK's word tokenizer and select comments 3-30 tokens long, including punctuation. To create a relatively balanced distribution of comment length, we perform down-sampling, capping by the number of comments with the median token count (12).
Sentiment balancing. We reduce sentiment bias by removing subreddits with little representation of positive, negative, ambiguous, or neutral sentiment. To estimate a comment's sentiment, we run our emotion prediction model, trained on a pilot batch of 2.2k annotated examples. The mapping of emotions into sentiment categories is found in Figure 2. We exclude subreddits consisting of more than  $30\%$  neutral comments or less than  $20\%$  of negative, positive, or ambiguous comments.
Emotion balancing. We assign a predicted emotion to each comment using the pilot model described above. Then, we reduce emotion bias by downsampling the weakly-labelled data, capping by the number of comments belonging to the median emotion count.
Subreddit balancing. To avoid over representation of popular subreddits, we perform downsampling, capping by the median subreddit count.
From the remaining 315k comments (from 482 subreddits), we randomly sample for annotation.
Masking. We mask proper names referring to people with a [NAME] token, using a BERT-based Named Entity Tagger (Tsai et al., 2019). We mask religion terms with a [RELIGION] token. The list of these terms is included with our dataset. Note that raters viewed unmasked comments during rating.
3.2 Taxonomy of Emotions
When creating the taxonomy, we seek to jointly maximize the following objectives.
1. Provide greatest coverage in terms of emotions expressed in our data. To address this, we manually labeled a small subset of the data, and ran a pilot task where raters can suggest emotion labels on top of the pre-defined set.
$^{2}$ https://github.com/dewarim/)\
<http://redditlist.com/nsfw>
2. Provide greatest coverage in terms of kinds of emotional expression. We consult psychology literature on emotion expression and recognition (Plutchik, 1980; Cowen and Keltner, 2017; Cowen et al., 2019b). Since, to our knowledge, there has not been research that identifies principal categories for emotion recognition in the domain of text (see Section 2.2), we consider those emotions that are identified as basic in other domains (video and speech) and that we can assume to apply to text as well.
3. Limit overlap among emotions and limit the number of emotions. We do not want to include emotions that are too similar, since that makes the annotation task more difficult. Moreover, combining similar labels with high coverage would result in an explosion in annotated labels.
The final set of selected emotions is listed in Table 4, and Figure 1. See Appendix B for more details on our multi-step taxonomy selection procedure.
3.3 Annotation
We assigned three raters to each example. For those examples where no raters agree on at least one emotion label, we assigned two additional raters. All raters are native English speakers from India.<sup>4</sup>
Instructions. Raters were asked to identify the emotions expressed by the writer of the text, given pre-defined emotion definitions (see Appendix A) and a few example texts for each emotion. Raters were free to select multiple emotions, but were asked to only select those ones for which they were reasonably confident that it is expressed in the text. If raters were not certain about any emotion being expressed, they were asked to select Neutral. We included a checkbox for raters to indicate if an example was particularly difficult to label, in which case they could select no emotions. We removed all examples for which no emotion was selected.
The rater interface. Reddit comments were presented with no additional metadata (such as the author or subreddit). To help raters navigate the large space of emotion in our taxonomy, they were presented a table containing all emotion categories aggregated by sentiment (by the mapping in Figure 2) and whether that emotion is generally expressed towards something (e.g. disapproval) or is
Number of examples	58,009
Number of emotions	27 + neutral
Number of unique raters	82
Number of raters / example	3 or 5
Marked unclear or difficult to label	1.6%
Number of labels per example	1: 83%
2: 15%
3: 2%
4+: 2%
Number of examples w/ 2+ raters agreeing on at least 1 label	54,263 (94%)
Number of examples w/ 3+ raters agreeing on at least 1 label	17,763 (31%)
Table 2: Summary statistics of our labeled data.
more of an intrinsic feeling (e.g. joy). The instructions highlighted that this separation of categories was by no means clear-cut, but captured general tendencies, and we encouraged raters to ignore the categorization whenever they saw fit. Emotions with a straightforward mapping onto emojis were shown with an emoji in the UI, to further ease their interpretation.
Table 2 shows summary statistics for the data. Most of the examples (83%) have a single emotion label and have at least two raters agreeing on a single label (94%). The Neutral category makes up 26% of all emotion labels – we exclude that category from the following analyses, since we do not consider it to be part of the semantic space of emotions.
Figure 1 shows the distribution of emotion labels. We can see a large disparity in terms of emotion frequencies (e.g. admiration is 30 times more frequent than grief), despite our emotion and sentiment balancing steps taken during data selection. This is expected given the disparate frequencies of emotions in natural human expression.
4.1 Interrater Correlation
We estimate rater agreement for each emotion via interrater correlation (Delgado and Tibau, 2019). For each rater  $r \in R$ , we calculate the Spearman correlation between  $r$ 's judgments and the mean
<sup>5</sup>We use correlations as opposed to Cohen's kappa (Cohen, 1960) because the former is a more interpretable metric and it is also more suitable for measuring agreement among a variable number of raters rating different examples. In Appendix C we report Cohen's kappa values as well, which correlate highly with the values obtained from interrater correlation (Pearson  $r = 0.85$ ,  $p < 0.001$ ).
$^{4}$ Cowen et al. (2019b) find that emotion judgments in Indian and US English speakers largely occupy the same dimensions.
Figure 1: Our emotion categories, ordered by the number of examples where at least one rater uses a particular label. The color indicates the interrater correlation.
of other raters' judgments, for all examples that  $r$  rated. We then take the average of these rater-level correlation scores. In Section 4.3, we show that each emotion has significant interrater correlation, after controlling for several potential confounds.
Figure 1 shows that gratitude, admiration and amusement have the highest and grief and nervousness have the lowest interrater correlation. Emotion frequency correlates with interrater agreement but the two are not equivalent. Infrequent emotions can have relatively high interrater correlation (e.g., fear), and frequent emotions can have relatively low interrater correlation (e.g., annoyance).
4.2 Correlation Among Emotions
To better understand the relationship between emotions in our data, we look at their correlations. Let  $N$  be the number of examples in our dataset. We obtain  $N$  dimensional vectors for each emotion by averaging raters' judgments for all examples labeled with that emotion. We calculate Pearson correlation values between each pair of emotions. The heatmap in Figure 2 shows that emotions that are related in intensity (e.g. annoyance and anger, joy and excitement, nervousness and fear) have a strong positive correlation. On the other hand, emotions that have the opposite sentiment are negatively correlated.
Figure 2: The heatmap shows the correlation between ratings for each emotion. The dendrogram represents the a hierarchical clustering of the ratings. The sentiment labeling was done a priori and it shows that the clusters closely map onto sentiment groups.
We also perform hierarchical clustering to uncover the nested structure of our taxonomy. We use correlation as a distance metric and ward as a linkage method, applied to the averaged ratings. The dendrogram on the top of Figure 2 shows that emotions that are related by intensity are neighbors, and that larger clusters map closely onto sentiment categories. Interestingly, emotions that we labeled as "ambiguous" in terms of sentiment (e.g. surprise) are closer to the positive than to the negative category. This suggests that in our data, ambiguous emotions are more likely to occur in the context of positive sentiment than that of negative sentiment.
4.3 Principal Preserved Component Analysis
To better understand agreement among raters and the latent structure of the emotion space, we apply Principal Preserved Component Analysis (PPCA) (Cowen et al., 2019b) to our data. PPCA extracts linear combinations of attributes (here, emotion judgments), that maximally covary across two sets of data that measure the same attributes (here, randomly split judgments for each example). Thus, PPCA allows us to uncover latent dimensions of
emotion that have high agreement across raters.
Unlike Principal Component Analysis (PCA), PPCA examines the cross-covariance between datasets rather than the variance-covariance matrix within a single dataset. We obtain the principal preserved components (PPCs) of two datasets (matrices)  $X,Y\in \mathbb{R}^{N\times |E|}$ , where  $N$  is the number of examples and  $|E|$  is the number of emotions, by calculating the eigenvectors of the symmetrized cross covariance matrix  $X^T Y + Y^T X$ .
Extracting significant dimensions. We remove examples labeled as Neutral, and keep those examples that still have at least 3 ratings after this filtering step. We then determine the number of significant dimensions using a leave-one-rater out analysis, as described by Algorithm 1.
We find that all 27 PPCs are highly significant. Specifically, Bonferroni-corrected p-values are less than  $1.5\mathrm{e} - 6$  for all dimensions (corrected  $\alpha = 0.0017$ ), suggesting that the emotions were highly dissociable. Such a high degree of significance for all dimensions is nontrivial. For example, Cowen et al. (2019b) find that only 12 out of their 30 emotion categories are significantly dissociable.
t-SNE projection. To better understand how the examples are organized in the emotion space, we apply t-SNE, a dimension reduction method that seeks to preserve distances between data points, using the scikit-learn package (Pedregosa et al., 2011). The dataset can be explored in our interactive plot<sup>6</sup>, where one can also look at the texts and the annotations. The color of each data point is the weighted average of the RGB values representing those emotions that at least half of the raters selected.
4.4 Linguistic Correlates of Emotions
We extract the lexical correlates of each emotion by calculating the log odds ratio, informative Dirichlet prior (Monroe et al., 2008) of all tokens for each emotion category contrasting to all other emotions. Since the log odds are  $z$ -scored, all values greater than 3 indicate highly significant ( $>3$  std) association with the corresponding emotion. We list the top 5 tokens for each category in Table 3. We find that those emotions that are highly significantly associated with certain tokens (e.g. gratitude with "thanks", amusement with "lol") tend to have the highest interrater correlation (see Figure 1). Conversely, emotions that have fewer significantly associated tokens (e.g. grief and nervousness) tend to have low interrater correlation. These results suggest certain emotions are more verbally implicit and may require more context to be interpreted.
5 Modeling
We present a strong baseline emotion prediction model for GoEmotions.
5.1 Data Preparation
To minimize the noise in our data, we filter out emotion labels selected by only a single annotator. We keep examples with at least one label after this filtering is performed — this amounts to  $93\%$  of the original data. We randomly split this data into train  $(80\%)$ , dev  $(10\%)$  and test  $(10\%)$  sets. We only evaluate on the test set once the model is finalized.
Even though we filter our data for the baseline experiments, we see particular value in the 4K examples that lack agreement. This subset of the data likely contains edge/difficult examples for the emotion domain (e.g., emotion-ambiguous text), and present challenges for further exploration. That is
$^{6}$ https://nlp.stanford.edu/~ddemszky/goemotions/tsne.html