Sentiment analysis of Jumia Morocco reviews β French & Darija NLP
# π Jumia Morocco β Sentiment Analysis
> **NLP project** | TF-IDF + Logistic Regression | French & Darija (Moroccan Arabic)
---
## π Overview
This project builds a **sentiment analysis classifier** for customer reviews scraped from **Jumia Morocco** (jumia.ma) β the leading e-commerce platform in Africa.
Reviews are written in a realistic mix of **French**, **Darija** (Moroccan Arabic dialect in Latin script), and **Arabizi**, making this a unique and challenging NLP task that reflects real-world Moroccan digital content.
**Sentiment labels** are derived automatically from star ratings:
| Stars | Label |
|-------|----------|
| ββ | Negative |
| βββ | Neutral |
| βββββ | Positive |
---
## ποΈ Project Structure
```
jumia-sentiment/
βββ data/
β βββ raw_reviews.csv # Scraped / sample reviews
βββ src/
β βββ scraper.py # Jumia Morocco web scraper
β βββ generate_sample_data.py # Generates realistic sample data
β βββ train_model.py # Full NLP training pipeline
βββ outputs/
β βββ sentiment_model.joblib # Saved trained model
β βββ figures/
β βββ eda_overview.png
β βββ confusion_matrix.png
β βββ top_features.png
βββ requirements.txt
βββ README.md
```
---
## βοΈ Installation
```bash
git clone
github.com
cd jumia-sentiment-analysis
pip install -r requirements.txt
```
---
## π Usage
### Step 1 β Get data
**Option A: Scrape live data from Jumia Morocco**
```bash
python src/scraper.py
```
**Option B: Generate a sample dataset (for testing)**
```bash
python src/generate_sample_data.py
```
### Step 2 β Train & evaluate
```bash
python src/train_model.py
```
---
## π§ NLP Pipeline
```
Raw Review Text
β
βΌ
Preprocessing
βββββββββββββ
β’ Lowercase
β’ Remove URLs, punctuation
β’ Remove French + Darija stopwords
β’ Preserve Arabizi digits (3 = ΨΉ, 7 = Ψ, 9 = Ω)
β
βΌ
TF-IDF Vectorizer
βββββββββββββββββ
β’ Unigrams + Bigrams
β’ max_features = 10 000
β’ sublinear_ β¦