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_ …