Logo Lanfrica

AminuAhmadh/naija-sentiment

Domain:

natural language processing

Record type:

software
Creator:
Ami
Host:
# πŸ‡³πŸ‡¬ 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 …