Sentiment analysis of flood risk perception in the Greater Accra Region of Ghana using X(Twitter) data
---
# Sentiment Analysis of Flood Risk Perception in Greater Accra using X/Twitter Data
## Project Overview
This project performs **Sentiment Analysis** on X/Twitter data to gauge public perception and emotional tone regarding flood risk in Ghana's Greater Accra Region. By scraping and analyzing tweets containing flood-related keywords, this study categorizes public sentiment into **Positive, Negative, and Neutral** classes. The goal is to provide insights into community concerns, government response perceptions, and overall social vulnerability, complementing traditional geospatial flood risk models with human-centric data.
## Study Area Context
The analysis focuses on public discourse surrounding flooding in the **Greater Accra Region**, Ghana's capital and most densely populated area. This region is highly vulnerable to flooding due to its:
* Low-lying coastal plains
* Rapid urbanization
* Inadequate drainage infrastructure
* Frequent heavy rainfall events
Understanding public sentiment here is crucial for effective disaster communication, policy-making, and community engagement strategies.
## Data Collection
* **Source:** X (formerly Twitter)
* **Method:** Data was scraped using third-party tools (Twitter Scraper & Twitter Scraper V2) on Apify.com.
* **Keywords:** Tweets were collected using flood-related buzzwords and specific location names (e.g., `"Weija flood"`, `"Adabraka flood"`, `"Tse Addo flood"`, `"Kaneshie flood"`, `"Odaw drain"`).
* **Dataset:** 1,232 publicly accessible user tweets were collected and downloaded in CSV format.
* **Data Fields:** The dataset includes:
* `tweet` (text content)
* `author username`, `location`, `description`
* `date` of tweet
* Engagement metrics (`likes count`, `retweets`)
* Author account details (`followers`, `following`, `account creation date`)
## Methodology & Processing
### 1. Data Preprocessing
Raw tweet data contains noise that must be cleaned for accurate analysis. The fol …