# 🇳🇬 Naija Sentiment v2
> Real-time Twitter sentiment analysis for Nigerian political parties — APC & ADC
Built with VADER + Nigerian political lexicon, Google Gemini AI summaries, and a dark-mode Streamlit dashboard.
---
## What's new vs v1
| Feature | v1 | v2 |
|---|---|---|
| Sentiment engine | TextBlob (movie review corpus) | VADER + Nigerian slang lexicon |
| Nigerian language support | ❌ | ✅ Pidgin, political slang, key terms |
| Dashboard design | Basic | Dark mode, Plotly charts, animations |
| AI summaries | Gemini | Gemini (improved prompt) |
| Demo mode | ❌ | ✅ Works without any API keys |
| Comparison tab | ❌ | ✅ Head-to-head APC vs ADC |
| Score distribution | ❌ | ✅ Histogram + timeline |
| Tweet feed | Basic | Filterable, sorted by score |
---
## Quickstart
```bash
# 1. Clone
git clone
github.com
cd naija-sentiment
# 2. Install dependencies
pip install -r requirements.txt
# 3. Set up environment variables
cp .env.example .env
# Edit .env with your API keys
# 4. Run the dashboard
streamlit run app.py
```
### No API keys? No problem.
The dashboard has a built-in demo mode with realistic mock tweets.
In the sidebar → Controls → **Use demo data** → **Load Demo Data**.
---
## API Keys
### Twitter Bearer Token
- Go to developer.twitter.com
- Create a project and app (free tier = Basic, ~$0/month for limited access)
- Copy your **Bearer Token** into `.env`
### Google Gemini API Key
- Go to ai.google.dev
- Free tier available, no credit card needed
- Copy your key into `.env`
---
## Project Structure
```
naija-sentiment/
├── app.py # Main Streamlit dashboard
├── src/
│ ├── scraper.py # Twitter API v2 fetcher (Tweepy)
│ ├── sentiment.py # VADER + Nigerian lexicon analyzer
│ ├── summarizer.py # Gemini AI summarizer
│ └── mock_data.py # Demo data generator
├── data/
│ ├── apc_tweets.json # Fetched/cached APC tweets
│ └── adc_tweets.jso …