Logo Lanfrica

symo101/kenya-news-sentiment-tracker

Domain:

natural language processing

Record type:

project
Creator:
sym
Host:
NLP sentiment analysis of Kenyan news headlines scraped from StandardMedia.co.ke TextBlob scoring, category breakdown and live headline scorer deployed on Streamlit # πŸ“° Kenya News Sentiment Tracker > NLP project β€” real Kenyan news headlines scraped from StandardMedia.co.ke, analysed for sentiment using TextBlob and deployed as a live interactive dashboard. πŸ”— **Live App:** kenya-news-sentiment-tracker.streamlit.app --- ## πŸ“Έ Screenshots --- ## 🎯 Project Overview This project scrapes real headlines from **StandardMedia.co.ke** across 6 news categories, scores each headline's sentiment using **TextBlob NLP**, and visualises the results in an interactive Streamlit dashboard. **Key Question:** *Is Kenyan news coverage mostly positive, negative or neutral β€” and which categories drive the most negative sentiment?* --- ## πŸ”„ Project Pipeline ``` SCRAPE ──► CLEAN ──► SENTIMENT ──► VISUALISE ──► DEPLOY ``` --- ## πŸ“ Project Structure ``` kenya-news-sentiment-tracker/ β”‚ β”œβ”€β”€ app.py # Streamlit dashboard β”œβ”€β”€ standard_scraper.py # Web scraper β”œβ”€β”€ sentiment_analysis.ipynb # Cleaning + sentiment notebook β”‚ β”œβ”€β”€ news_raw.csv # Raw scraped headlines (214 rows) β”œβ”€β”€ news_clean.csv # Cleaned + scored dataset (213 rows) β”‚ β”œβ”€β”€ requirements.txt # Python dependencies └── README.md ``` --- ## πŸ” Stage Breakdown ### 1️⃣ Web Scraping β€” `standard_scraper.py` - Built with `requests` and `BeautifulSoup` - Used Chrome DevTools to identify stable article link selectors - Scraped 6 categories: Politics, Business, Health, Sports, World, Counties - Fields collected: headline text, category, URL, scraped timestamp - Output: `news_raw.csv` β€” **214 headlines** ### 2️⃣ Cleaning β€” `sentiment_analysis.ipynb` - Removed extra whitespace and special characters - Dropped duplicate and very short headlines - Parsed timestamps into proper datetime format - Output: `news_clean.csv` β€” **213 headlines, 0 missing values** ### 3️⃣ Sentiment Analysis β€” `sentiment_analysis.ipynb` - Scored every headline using **TextBlob** polarity - Polarity range: –1.0 (very negative) β†’ 0.0 (neutra …