ANLP_WS24_CA2/README.md

3.2 KiB

ANLP_WS24_CA2

This repository contains the necessary scripts, data, and notebooks for analyzing and modeling the linguistic and structural features of humor in jokes. The project focuses on leveraging NLP techniques to analyze humor in text data, and aims to predict the humor score numerically using regression models.


Objektive

Leverage advanced NLP techniques (CNN, BERT, and Transformer) to analyze text data and build an application that predicts humor ratings.

Research Question

  • Can Deep neural networks predict humor ratings with an RMSE greater than or equal to the baseline of 0.8609 ?

Data Source

The data is sourced from the SemEval-2021 Task 7: It contains a dataset of humor and offense ratings for jokes. The jokes are annotated with a humor rating on a scale from 0 to 4.

Data embeddings

Preprocessing Steps

1. Load and clean data: The data set is loaded and all rows with missing humor_rating values are removed. In addition, the target variable for the humor rating is extracted.

2. text embeddings: Pre-trained GloVe embeddings are loaded and converted into a matrix that can be used for modeling.

3. data splitting: The data set is split into training, test and validation data to train and evaluate the models later.

4. ensemble data indices: Various methods for creating data indices are provided to prepare the training data for ensemble methods.

Repository Structure

  • data/: Contains the dataset hack.csv, which includes raw joke data.
  • Notebooks:
    • Used for data analysis and visualization.
    • represent the models

Getting Started

Install Requirements

Run the following command to install the required dependencies:

pip install -r requirements.txt

Preprocess Data

This is carried out automatically when the models are executed

Workflow

1. Preprocessing

The text data is cleaned and transformed into formats suitable for analysis. The preprocessing steps include tokenization, stopword removal, and lemmatization.

2. Model Training

Various machine learning models, including Convolutional Neural Networks (CNNs), Long Short-Term Memory Networks (LSTMs), BERT, and Transformers, are trained to predict the humor rating of jokes based on their linguistic features.

3. Model Evaluation

The trained models are evaluated to determine their performance in predicting humor ratings. Metrics such as RNSE (Root Mean Squared Error) and R² scores are used to assess the models.

4. Classification and Regression

While the primary goal of the project is to predict the numerical humor rating (regression task), we also experiment with classification models for humor detection (e.g., humor vs. non-humor)