This project focuses on building a sentiment analysis model for African languages using the AfriSenti dataset. The main goal is to train a model that can predict whether a sentence written in isiZulu expresses a positive or negative emotion.
# 🧠 Swahili Sentiment Analysis using and Transformer Models
This project investigates sentiment analysis for **Swahili**, one of Africa's most widely spoken languages, using both traditional machine learning algorithms and state-of-the-art transformer models.
The objective is to determine whether a Swahili tweet expresses **positive**, **neutral**, or **negative** sentiment while evaluating whether African language-specific transformer models outperform conventional machine learning techniques.
---
## 📌 Project Overview
Natural Language Processing (NLP) has achieved remarkable success for English and other high-resource languages. However, African languages such as Swahili remain underrepresented due to limited annotated datasets and language resources.
This project addresses this challenge by benchmarking traditional machine learning models against transformer-based architectures using the **AfriSenti Swahili dataset**.
---
## 🎯 Objectives
The project aims to:
- Perform sentiment analysis on Swahili tweets
- Build an end-to-end NLP pipeline
- Compare traditional machine learning models with transformer models
- Evaluate whether African language pretraining improves performance
- Analyse model strengths and weaknesses through error analysis
- Establish a strong baseline for future Swahili NLP research
---
## 📂 Dataset
This project uses the **AfriSenti Swahili Dataset**, containing manually labelled Swahili tweets.
Sentiment labels include:
- 😀 Positive
- 😐 Neutral
- 😞 Negative
---
## 🚀 Project Pipeline
The workflow consists of:
1. Data Collection
2. Data Cleaning
3. Text Preprocessing
4. Feature Engineering
5. TF-IDF Vectorisation
6. Baseline Machine Learning Models
7. Transformer Fine-tuning
8. Model Evaluation
9. Error Analysis
10. Performance Comparison
---
## 🧹 Data Preprocessing
The following preprocessing steps were applied:
- Remove URLs
- Remove Twitter mentions
- Remove punctuation
- Remove special characters
- Remove extra whitespace …