Logo Lanfrica

KwameCode27/Hausa_Sentiment-_Analysis_Project

Domain:

natural language processing

Record type:

project
Creator:
Kwa
Host:
# Hausa Sentiment Analysis for Ghana πŸ‡¬πŸ‡­ > **Machine Learning-Based Sentiment Analysis for Hausa Social Media Content in Ghana** > Department of Computer Science Β· Research Project Β· 2026 --- ## Overview This project builds a supervised machine learning pipeline that classifies Hausa-language text from social media and news sources into three sentiment classes: **positive**, **negative**, and **neutral**. The pipeline is designed around two complementary goals: 1. **Academic benchmarking** – train and evaluate on the AfriSenti Hausa dataset so results can be compared against published state-of-the-art systems. 2. **Applied inference** – run the trained model on unlabelled Ghana-focused Hausa news articles (scraped from BBC Hausa, VOA Hausa, and DW Hausa) to analyse real-world sentiment trends relevant to Ghanaian communities. --- ## Architecture ``` Raw Text (TSV / CSV) β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ HausaTextPreprocessor (src/utils.py) β”‚ β”‚ β€’ Lowercase & strip noise β”‚ β”‚ β€’ Remove URLs / mentions / hashtags β”‚ β”‚ β€’ Normalise repeated characters β”‚ β”‚ β€’ Tokenise & remove stopwords β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ FeatureUnion β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Char TF-IDF β”‚ β”‚ 3–5-grams β”‚ β”‚ Word TF-IDF β”‚ β”‚ unigrams + bigrams β”‚ β”‚ Length feat. β”‚ β”‚ scaled β”‚ β”‚ Lexicon feat. β”‚ β”‚ 11 numeric features, scaled β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Classifier β”‚ β”‚ MultinomialNB OR β”‚ β”‚ LogisticRegression β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Predicted Label β”‚ β”‚ positive / neutral β”‚ β”‚ / negative β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## Results All results below are from the **held-out AfriSenti Hausa test set** (5,303 samples). | Model | Vectoriser | Accuracy | Macro-F1 | Macro-P | Macro-R | |---|---|---|---|---|---| | Multinomial NaΓ―ve Bayes | TF-IDF | 74.7% | 0.748 | 0.750 | 0.747 …