# Rwanda Political Sentiment Analysis
An end-to-end NLP pipeline that collects, preprocesses, labels, and classifies
sentiment in tweets about Rwandan politics — with an interactive Streamlit dashboard.
---
## 📌 Table of Contents
- Overview
- Demo
- Project Structure
- Pipeline
- Results
- Key Findings
- Tech Stack
- Setup & Usage
- Lessons Learned
- Author
---
## Overview
This project analyzes public sentiment on Twitter/X about Rwandan political topics using machine learning and NLP. It covers the full ML pipeline — from data collection to a deployed interactive dashboard.
**Problem:** What is the overall sentiment of English-language tweets about Rwandan politics, and which words most influence that sentiment?
**Approach:**
1. Collect tweets using keyword search (no expensive API — auth token approach via Scweet)
2. Clean and preprocess text
3. Label sentiment using VADER auto-labeling + 200 manual annotations
4. Train and compare two models: Logistic Regression baseline vs AfroXLMR transformer
5. Explain predictions using SHAP values
6. Deploy an interactive dashboard on Streamlit Cloud
---
## Demo
> 🚀 **Live Dashboard →
| Overview | Trends | Explainability | Live Predictor |
|---|---|---|---|
| Sentiment distribution charts | Monthly trend lines | SHAP word importance | Real-time tweet classification |
---
## Project Structure
```
rwanda_sentiment/
├── data/
│ ├── raw/ # collected tweets (CSV)
│ └── processed/ # cleaned, labeled datasets
├── src/
│ ├── collect_tweets.py # Phase 1: Twitter/X scraping
│ ├── preprocess.py # Phase 2: text cleaning
│ ├── label.py # Phase 3: VADER + manual labeling
│ ├── train.py # Phase 4: model training
│ └── explain.py # Phase 5: SHAP explainability
├── dashboard/
│ └── app.py # Phase 6: Streamlit dashboard
├── models/
│ ├── logistic_regression.pk …