Skip to content

BillDin/TextEmotionRecog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI & CogSci Midterm Project

Description

This project focuses on detecting positive, neutral, or negative feelings based on text. These feelings include but are not limited to anger, fear, happiness, sadness, and surprise. We design and implement the neural network that imitates human ability of text-based empathy of emotions. To train our neural network, we use existing datasets ISEAR and TWEETS, containing information of texts and their corresponding emotions. The goal of this neural network is to predict human emotion based on the input sentence.

Get Started

Package Dependency

Please install all the package in the requirements, including;

pip install pandas pandas_access nltk numpy keras tensorflow

Copy the following lines into a python file and download the content.

import nltk
nltk.download('punkt')
nltk.download('stopwords')
nltk.download('wordnet')

Structures

Dataset used in this project is located in the following places:

All the source code is placed in here:

  • Preprocess provides function to preprocessing the text data before vectorizing them into number vectors.
  • Model includes all the layer
  • MDB Reader provides a function to decode .mdb file.
  • Embedding helps to create the embedding layer in neural network
  • SVM helps to create svm classification methods

Glove is a pretrained embedding layer for text training.

Doc includes all the designed documentation inside

Ipynb contains all the jupyter notebook that shows a demo of how our neural network performs

Run

Sample code for each dataset is placed in here. All the scripts for two datasets is runable by command:

python <filename>

This file provides detailed implementation of how to using this dataset to train the neural network. With some adjustment, the best performance is around 60% accuracy. In the file, we use 7 categories of emotions for classifications.

II. TWEETS

This file provides implementations for Tweets dataset, where the number of categories can be 13 or 3, which is adjustable by changing the constant SIMPLE_CATEGORY. Other constants is used for different meaning as indicating inside the file.

Further work

Further work can implement by importing scripts in src folder.

Reference

About

Deep learning based on LSTM model to detect emotion from text

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published