Moroccan Arabic Sentiment Analysis
# Sentiment Analysis of Moroccan Arabic (Darija)
> A comparative study of sentiment analysis approaches for Moroccan Arabic (Darija), benchmarking fine-tuned BERT models, FastText embeddings, traditional ML classifiers, and large language models (GPT-4 Turbo, Google Gemini) across two Darija datasets.
## Table of Contents
- Context and Motivation
- Research Questions
- Architecture Overview
- Features
- Tech Stack
- Project Structure
- Models
- BERT-Based Models
- FastText-Based Model
- GPT-4 Turbo
- Google Gemini
- Traditional ML Models (PyCaret)
- Datasets
- MAC Dataset
- MYC Dataset
- Text Preprocessing Pipeline
- Training
- Evaluation
- Experiment Tracking
- Configuration
- Installation and Setup
- Usage Examples
- Notebooks
- License
---
## Context and Motivation
Sentiment analysis for Moroccan Arabic (Darija) poses unique challenges that standard Arabic NLP tools do not adequately address:
- **Darija is a low-resource dialect.** Unlike Modern Standard Arabic (MSA), Darija lacks standardized orthography. Speakers write the same word in multiple ways, mix Arabic script with Latin characters (Arabizi), and borrow heavily from French and Spanish.
- **Existing Arabic NLP models are trained primarily on MSA.** BERT models pretrained on formal Arabic text may not generalize well to the informal, dialectal nature of Darija social media content.
- **Code-switching is pervasive.** Moroccan social media users frequently switch between Darija, MSA, French, and Arabizi within a single sentence, making tokenization and classification significantly harder.
- **Large language models remain unproven for Darija.** While GPT-4 and Gemini demonstrate strong multilingual capabilities, their effectiveness on Darija sentiment classification has not been systematically evaluated.
This project investigates whether fine-tuned encoder models (BERT variants) outperform zero-shot large language models on Darija sentiment classification, and whether models pretrained specifically o …