# π©πΏ Algerian Multilingual NLP Sentiment Analyzer
A specialized Machine Learning Natural Language Processing pipeline designed to classify sentiments in complex multilingual contexts prevalent in Algeria and North Africa.
---
## π‘ Overview
In Algeria, social conversations and community feedback naturally fluidly combine **Standard Arabic**, **Algerian Darija (both Arabic script and Latin Arabizi with digits 3, 7, 9, 5)**, **French**, and **English**. Standard off-the-shelf sentiment models struggle heavily with this code-switching reality.
This project implements:
1. **Multilingual Code-Switching Normalizer**: Removes diacritics, normalizes Arabic variants, handles Arabizi phonetics and character repetitions.
2. **Subword & N-Gram TF-IDF Vectorization**: Preserves character-level dialect markers and morphological roots.
3. **Calibrated Logistic / Softmax Classification**: Produces probability distributions across Positive, Neutral, and Negative classes.
---
## β‘ Quick Start
### 1. Installation
```bash
git clone
github.com /algerian-multilingual-nlp-sentiment.git
cd algerian-multilingual-nlp-sentiment
pip install -r requirements.txt
```
### 2. Interactive CLI Mode
```bash
python app.py
```
### 3. Example Code Usage
```python
from sentiment_classifier import AlgerianSentimentAnalyzer
analyzer = AlgerianSentimentAnalyzer()
analyzer.train()
result = analyzer.predict("raw3a had l'projet, foooort bzaf!")
print(result['predicted_sentiment']) # Output: positive
print(result['confidence']) # Output: 0.94
```
### 4. Batch Prediction
```bash
python app.py --batch sample_inputs.txt --out predictions.json
```
---
## π Pipeline Architecture
```
[Raw User Text (Arabic / Darija / Arabizi / FR / EN)]
β
[Multilingual Normalization & Arabizi Handler]
β
[Character & Word N-Gram TF-IDF]
β
[Calibrated Multiclass Logistic Classifier]
β
{ Sentiment: "Positive", Confidence: 0.94 }
```
---
## π License
MIT License - Developed with pride by an Algeria β¦