# Sentiment Analysis of Moroccan Darija Arabizi
Core code and re-annotated dataset for a three-class sentiment classification study of
Moroccan Darija written in Arabizi (Latin script with phonetic digits). The study
fine-tunes five pretrained BERT-family encoders and compares them against a classical
character n-gram baseline, using five-fold cross-validation repeated over five random
seeds and swept across three learning rates.
This repository contains the *core* pipeline only: dataset construction, model
fine-tuning, and results analysis. Presentation-layer tooling used elsewhere in the
project (figure generation, spreadsheet reporting, tokenizer probing) is intentionally
excluded.
## Task and label scheme
Each comment is assigned one of three sentiment classes:
| Label (on disk) | Internal id | Class name | Definition |
|---|---|---|---|
| `-1` | `0` | negative | expresses a personal negative sentiment |
| `0` | `1` | neutral | informative or objective, no personal sentiment |
| `+1` | `2` | positive | expresses a personal positive sentiment |
Sarcasm is judged from context. Emojis are removed in preprocessing. The internal
remapping `{-1: 0, 0: 1, 1: 2}` is applied only inside the model head; all CSV files use
the `-1 / 0 / +1` convention.
## Repository contents
| File | Type | Description |
|---|---|---|
| `build_annotations.py` | code | Merges the two raw annotator exports into a single labelled set; separates agreed rows from disagreements. |
| `adjudicate_disagreements.py` | code | Resolves annotator disagreements by a fixed-seed random A/B pick and produces the final training set. |
| `finetune_darija_sentiment.py` | code | Fine-tunes the five transformers and the baseline over the seed/fold/learning-rate grid; writes per-run predictions and an aggregated summary. |
| `evaluate_darija_models.py` | code | Computes pairwise significance, confusion matrices, learning-rate sensitivity, and a Darija-specific error breakdown from the saved predictions. …