The goal of this project is to analyze public sentiment around Kenyan politics by extracting, cleaning, and analyzing tweets related to key political figures, parties, and trending political topics. This will provide insights into public opinion, voter sentiment, and political trends in Kenya.
# Twitter Sentiment Analysis on Kenyan Politics – Project Plan
## **1. Project Overview**
The goal of this project is to analyze public sentiment around Kenyan politics by extracting, cleaning, and analyzing tweets related to key political figures, parties, and trending political topics. This will provide insights into public opinion, voter sentiment, and political trends in Kenya.
---
## **2. Project Objectives**
* **Understand Public Sentiment:** Assess how Kenyans feel about key political figures, parties, and major political events.
* **Track Political Trends:** Identify shifts in sentiment over time and during major political events (e.g., elections, rallies, scandals).
* **Measure Impact of Hashtags:** Evaluate the influence of popular political hashtags like #Maandamano, #AzimioLaUmoja, #KenyaKwanza, #RutoThe5th.
* **Identify Key Influencers:** Detect influential accounts driving political discussions.
---
## **3. Tools and Technologies**
* **Data Collection:** Tweepy (Python), Twitter API, SNScrape (optional for bypassing API limits)
* **Data Preprocessing:** Pandas, NLTK, Regular Expressions
* **Sentiment Analysis:** VADER, TextBlob, BERT (Hugging Face), or a fine-tuned LLM
* **Data Visualization:** Matplotlib, Seaborn, Plotly, WordCloud
* **Deployment (Optional):** Streamlit or Flask for a live sentiment dashboard
---
## **4. Data Collection**
### **4.1 Twitter API Setup**
* Create a Twitter Developer account and get API keys and tokens.
* Set up the Tweepy library or use SNScrape for more flexibility.
* Filter tweets based on:
* Keywords: Ruto, Raila, Gachagua, #KenyaPolitics, #Maandamano, #RutoThe5th
* Language: English and Swahili
* Location: Focus on Kenya (use geo-location filters if possible)
### **4.2 Data Collection Strategy**
* Use both real-time streaming (Twitter API v2) and historical search (SNScrape) for comprehensive coverage.
* Capture metadata like date, retweets, likes, and user followers to assess tweet impact.
* Store dat …