Giter Club home page Giter Club logo

appraisal-emotion-classification's Introduction

This repository contains the Appraisal enISEAR dataset: A reannotation of the enISEAR corpus with Cognitive Appraisal. Further, this repository contains python code that was used for the experiments in the paper Appraisal Theories for Emotion Classification in Text.

Jan Hofmann, Enrica Troiano, Kai Sassenberg, and Roman Klinger. Appraisal theories for emotion classification in text. In Proceedings of the 28th International Conference on Computational Linguistics, 2020. [ bib | http]

In addition, this repository provides scripts to reproduce the results of the models reported in the paper. For more information about the Appraisal enISEAR dataset see the Corpora Overview.


Requirements

Installation using Anaconda

  1. Install Anaconda
  2. Install Tensorflow environment
conda create -n tf tensorflow=1.14  # (CPU-Version)
conda create -n tf tensorflow-gpu=1.14 # (GPU-Version)
  1. Activate Tensorflow environment and install futher dependencies
conda activate tf;
pip3 install numpy==1.16.4 pandas sklearn keras==2.3.0 gensim;

Manual Installation

CPU Only

  • Python 3.5+
  • Install dependencies:
pip3 install --user numpy==1.16.4 pandas sklearn keras==2.3.0 gensim tensorflow==1.14

GPU Support (nvidia)

  • Python 3.5 or 3.6
  • Install dependencies:
pip3 install --user numpy==1.16.4 pandas sklearn keras==2.3.0 gensim tensorflow-gpu==1.14
  • Install cuda (Testet with cuda 10.0.130)
  • Install cuDNN (Tested with cudnn 7.6.5.32-2)

This configuration was tested on linux with python 3.8.1 for CPU and python 3.5.9 for GPU support.

Reproducing Results on 'Appraisal enISEAR'

Baseline Results

To start the baseline models on the enISEAR dataset navigate to the baseline directory with cd impl-z-baseline; then run

python3 baseline_CNN.py --dataset enISEAR
python3 baseline_MaxEnt.py --dataset enISEAR

Appraisal predictions based on Text

In order to reproduce the ''appraisal prediction from text'' experiment navigate to the ''main experiment'' directory with cd impl-main-experiments;. Then run

python3 a_appraisals_from_text.py --dataset enISEAR_V1

To run the model on the automated annotations run

python3 a_appraisals_from_text.py --dataset enISEAR_V3

Emotion predictions based on Appraisals

In order to predict emotions from appraisals navigate to the ''main experiment'' directory with cd impl-main-experiments;. Then run

python3 b_emotions_from_appraisals.py --dataset enISEAR_V1

Pipeline Experiment

In order to reproduce the ''appraisal-emotion-pipeline'' experiment navigate to the ''main experiment'' directory with cd impl-main-experiments;. Then run

python3 c_pipeline.py --dataset enISEAR_V1

Multi-task and Oracle Experiment

In order to reproduce the multi-task experiment navigate to the additional experiments directory with cd impl-x-additional-experiments;. Then run

python3 multi_task_fully_shared.py --dataset enISEAR_V1

or

python3 oracle_CNN_saveModels.py --dataset enISEAR_V1 --rounds 1

Annotating unlabeled Text Instances with Appraisals

The scripts can be used to predict appraisals on text instances with no emotions labels.
To do this first navigate to the ''main experiment'' directory with cd impl-main-experiments;
Then run the b_appraisals_from_text.py script with the --annotate option:

python3 b_appraisals_from_text.py -d enISEAR_V1 --annotate <TextInstances>.csv

You can also skip training to predict appraisals by using the pre-trained model, which was trained to predict appraisals on 'appraisal enISEAR'
To annotate your text instances using the pre-trained model run:

python3 b_appraisals_from_text.py -d enISEAR_V1 --annotate <TextInstances>.csv --loadmodel ../pre-trained/enISEAR_V1_appraisal_predictor.h5

Your dataset annotated with predicted appraisals will be saved to 'TextInstances_appraisals.csv'
Note that your dataset musst be formatted as follows:
Sentence
<Text Instance 1>
<Text Instance 2>
<Text Instance 3>
.
.
.

This means the first line in the file musst be 'Sentence' followed by your text instances (one in every line).

appraisal-emotion-classification's People

Contributors

bluzukk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.