# Luganda Sentiment Analysis — Prototype
A working proof-of-concept for *"A Comparative Evaluation of Transformer-Based
Models for Sentiment Analysis of Low-Resource Luganda Social Media."*
It demonstrates the full pipeline your proposal describes (Chapter 3) end-to-end
on a small scale, so you can show your advisor a running system while you
build out the real dataset.
## ⚠️ Important: the sample data is a placeholder
`data/sample_data.csv` contains 40 short Luganda sentences I wrote using
general vocabulary knowledge — **it has not been verified by a fluent
Luganda speaker or checked for dialectal accuracy.** Do not use it as your
research dataset or cite results from it in your final report. Its only
purpose is to let the training/demo code run so you can see the pipeline
work. Swap it out for real annotated data before you generate any results
for your report (see "Scaling up" below).
## What's included
```
luganda_sentiment_prototype/
├── data/sample_data.csv # placeholder dataset (40 rows, 3 classes)
├── src/train.py # fine-tunes a transformer + reports metrics
├── src/app.py # Gradio demo: type text, get sentiment
├── requirements.txt
└── README.md
```
## How to run it
**Recommended: Google Colab** (free GPU, avoids local setup issues)
1. Upload the whole folder to Colab or clone it into a Colab notebook.
2. Set runtime to GPU (Runtime → Change runtime type → T4 GPU).
3. Run:
```bash
pip install -r requirements.txt
python src/train.py --model xlm-roberta-base --epochs 3
```
4. This trains on the 70/15/15 split, prints accuracy/precision/recall/F1
on the test set, and saves the model to `model_output/`.
**Try another model** — matches your Objective 2 (BERT, RoBERTa, XLM-R):
```bash
python src/train.py --model bert-base-multilingual-cased
python src/train.py --model roberta-base
```
(Note: plain `roberta-base` is English-only; for a fair multilingual
comparison, consider `xlm-roberta-base`, `bert-base-multilingual-cased`, …