ππΊ GuiltRoBERTa-hu: A Two-Stage Classifier for Guilt-Assignment Rhetoric in Hungarian Political Texts
GuiltRoBERTa-hu is a two-stage AI pipeline for detecting guilt-assignment rhetoric in Hungarian political discourse.
It combines:
- Stage 1 β Emotion Pre-Filtering: emotion labels from the Babel Emotions Tool,
- Stage 2 β Guilt Classification: a fine-tuned binary XLM-RoBERTa model trained on manually annotated Hungarian texts (
guiltvsno_guilt).
The approach is grounded in political communication theory, which suggests that guilt attribution often emerges in anger-laden contexts.
Thus, only texts labeled as βAngerβ in Stage 1 are passed to the guilt classifier.
π§© Model Architecture
Stage 1: Emotion Pre-Filtering (Babel Emotions Tool)
- Tool: Emotions 6 Babel Machine (developed by PoltextLAB)
- Task: 6-class emotion classification (
Anger,Fear,Disgust,Sadness,Joy,None) - Input: CSV file with one text per row
- Output: CSV file with predicted labels and probabilities
- Usage: retain only rows with
predicted_emotion == "Anger"for Stage 2
βοΈ The Babel Emotions Tool is not an API but a web-based interface.
Upload a CSV file, download the labeled results, and use them as input to the guilt classifier.
The included notebook loads these predictions fromgold_standard_with_emotion_prediction.xlsx.
Stage 2: Guilt Classification
- Base model:
xlm-roberta-base - Task: Binary classification (
guilt,no_guilt) - Training data:
guilt_roberta_train.xlsx - Evaluation: Independent gold-standard dataset of Hungarian political discourse
π§ Motivation
Guilt assignment β attributing moral responsibility or blame β is a key rhetorical strategy in political communication.
Since guilt often appears alongside anger, direct one-stage classification risks conflating emotional tones.
This two-stage pipeline improves precision by:
- Filtering anger-related contexts first
- Then applying a dedicated guilt detector only where relevant
π Evaluation (Gold Standard)
| Stage 1 Filter | Threshold (Ο) | Precision | Recall | F1 | Accuracy |
|---|---|---|---|---|---|
| Anger-only | 0.01 | 0.78 | 0.95 | 0.85 | 0.75 |
Best configuration: Anger-only, Ο = 0.01
ROC-AUC = 0.61βPR-AUC = 0.82
The two-stage model improves F1 by β +0.20 compared to single-stage baselines.
π Usage Example
import pandas as pd
from transformers import AutoTokenizer, AutoModelForSequenceClassification, TextClassificationPipeline
# Load Babel emotion predictions
df = pd.read_excel("gold_standard_with_emotion_prediction.xlsx")
# Filter for 'Anger'
anger_df = df[df["emotion_predicted"] == "Anger"].copy()
# Load the guilt classifier
repo_id = "<your-org>/guiltroberta-hu"
tok = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForSequenceClassification.from_pretrained(repo_id)
pipe = TextClassificationPipeline(model=model, tokenizer=tok, return_all_scores=True)
# Apply predictions
anger_df["guilt_score"] = anger_df["text"].apply(lambda t: pipe(t)[0][1]["score"]) # score for 'guilt'
anger_df.to_excel("anger_with_guilt_predictions.xlsx", index=False)
- Downloads last month
- 19
Evaluation results
- precision on Independent Gold Standard (Hungarian Political Discourse)test set self-reported0.780
- recall on Independent Gold Standard (Hungarian Political Discourse)test set self-reported0.950
- f1 on Independent Gold Standard (Hungarian Political Discourse)test set self-reported0.850