Skip to content

ehsong/mood-metric

Repository files navigation

mood-metric

This metric was built using DepecheMood Lexicon which can retrieve scores for 8 ranges of mood - afraid, amused, angry, annoyed, don't care, happy, inspired, and sad for approximately 37K terms. For more information on the construction of the lexicon please see the paper:

Staiano, J., & Guerini, M. (2014). "DepecheMood: a Lexicon for Emotion Analysis from Crowd-Annotated News". Proceedings of ACL-2014. Paper available at http://www.anthology.aclweb.org/P/P14/P14-2070.pdf

Other than the code partly provided by the authors in their github, this code includes simple text preprocessing of removing punctuations, stop words, special characters, and tokenizing.

For more detailed background about the project, please see my medium post "Mood Metric: Detecting Mood at the Workplace Using Lexicon-Based Approach".

Example

Excerpt from Jane Austen's Pride and Prejudice

"When she remembered the style of his address, she was still full of indignation; but when she considered how unjustly she had condemned and upbraided him, her anger was turned against herself; and his disappointed feelings became the object of compassion."

mood metric

Applying Mood Metric on Slack Conversation Data

The metric was applied to an actual slack conversation data, which consisted around 5K messages. For the detailed preprocessing and application of the metric, please see the notebook here. In this notebook, I played around the threshold for classifying 'unclassified' mesages, depending on the normalized score I obtained for each message. The baseline was 3%, which refers to the percentage of the messages that could not be classified due to words that did not match with the messages.

Comparing Performance Against NRC

For this project, I compared the performance of DepecheMood with NRC Lexicon which includes 14K unigrams for 8 ranges of emotions. The performance of the two lexicons were tested on ISEAR data set which includes 7K self-written sentences for 7 emotion categories. The notebook is here. For this work I used ISEAR Loader which is a tool that helps loading ISEAR data in python.

Notes

To run the .py file please run the following command in terminal:
pip3 install seaborn
pip3 install spacy
python3.8 -m spacy download en_core_web_lg

About

Building a mood metric using DepecheMood lexicon.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published