This is a project for analyzing emotional intensity in movie subtitles. Using a transformer-based text classification model, the script extracts emotions from subtitles and generates visualizations to represent emotional trends over time.
The analysis is powered by the j-hartmann/emotion-english-distilroberta-base model from Hugging Face, which classifies text into various emotional categories using a fine-tuned DistilRoBERTa transformer model.
chart.py
: This script processes subtitles and generates emotion graphs for a single movie.heatmap.py
: This script generates a heatmap comparing emotional intensity trends across multiple movies.
- Install dependencies:
pip install -r requirements.txt
- Download
.srt
files into thedata/
folder. For example from https://www.opensubtitles.org - Run
chart.py
with an.srt
subtitle file as input:python chart.py ./data/subtitles.srt
- Run
heatmap.py
to generate a heatmap of emotional intensity across movies in./data
folder:python heatmap.py