Giter Club home page Giter Club logo

nlp-text-emotion's Introduction

Emotion Classification in Short Messages

Multi-class sentiment analysis problem to classify texts into five emotion categories: joy, sadness, anger, fear, neutral. A fun weekend project to go through different text classification techniques. This includes dataset preparation, traditional machine learning with scikit-learn, LSTM neural networks and transfer learning using BERT (tensorflow keras).

Datasets

Summary Table

Dataset Year Content Size Emotion categories Balanced
dailydialog 2017 dialogues 102k sentences neutral, joy, surprise, sadness, anger, disgust, fear No
emotion-stimulus 2015 dialogues 2.5k sentences sadness, joy, anger, fear, surprise, disgust No
isear 1990 emotional situations 7.5k sentences joy, fear, anger, sadness, disgust, shame, guilt Yes

links: dailydialog, emotion-stimulus, isear

Combined dataset

Dataset was combined from dailydialog, isear, and emotion-stimulus to create a balanced dataset with 5 labels: joy, sad, anger, fear, and neutral. The texts mainly consist of short messages and dialog utterances.

Experiments

Traditional Machine Learning:

  • Data preprocessing: noise and punctuation removal, tokenization, stemming
  • Text Representation: TF-IDF
  • Classifiers: Naive Bayes, Random Forrest, Logistic Regrassion, SVM
Approach F1-Score
Naive Bayes 0.6702
Random Forrest 0.6372
Logistic Regression 0.6935
SVM 0.7271

Neural Networks

  • Data preprocessing: noise and punctuation removal, tokenization
  • Word Embeddings: pretrained 300 dimensional word2vec (link)
  • Deep Network: LSTM, biLSTM, CNN
Approach F1-Score
LSTM + w2v_wiki 0.7395
biLSTM + w2v_wiki 0.7414
CNN + w2v_wiki 0.7580

Transfer learning with BERT

Finetuning BERT for text classification

Approach F1-Score
finetuned BERT 0.8320

nlp-text-emotion's People

Contributors

lukasgarbas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.