# π²π¦ Darija Text Summarization
Automatic text summarization for **Moroccan Darija** β three independent approaches ranging from classical NLP to deep learning, all trained/evaluated on the same CSV dataset.
---
## Repository Structure
```
darija-summarization/
β
βββ approach_1_nlp_extractive.py # TF-IDF sentence scoring (NLP)
βββ approach_2_ml_transformers.py # HuggingFace seq2seq fine-tuning (Deep ML)
βββ approach_3_ml_textrank.py # TextRank graph algorithm (Classical ML)
β
βββ dataset.csv # Your Darija dataset (add this)
βββ requirements.txt # All dependencies
βββ README.md
```
---
## Dataset Format
Place your dataset at the root as `dataset.csv` with at least these two columns:
| Column | Description |
|-----------|----------------------------------------------|
| `text` | Full Darija text to summarize |
| `summary` | Reference summary *(optional, for eval only)*|
> The scripts default to `text` and `summary` column names. You can change these via the `TEXT_COL` / `SUMMARY_COL` constants at the top of each file.
---
## π¬ Approach Comparison
| | Approach 1 | Approach 2 | Approach 3 |
|---|---|---|---|
| **File** | `approach_1_nlp_extractive.py` | `approach_2_ml_transformers.py` | `approach_3_ml_textrank.py` |
| **Type** | Extractive | **Abstractive** | Extractive |
| **Algorithm** | TF-IDF sentence scoring | mT5 / mBART fine-tuning | TextRank (PageRank on sentences) |
| **Needs labels?** | No | Yes | No |
| **Needs GPU?** | No | Recommended | No |
| **Output style** | Picks original sentences | Generates new text | Picks original sentences |
| **Speed** | Very fast | Slow (training) | Fast |
| **Best for** | Quick baseline | Highest quality | Balanced accuracy/speed |
---
## Quick Start
### 1. Install dependencies
```bash
pip install -r requirements.txt
```
Or install per approach:
```bash
# Approach 1
pip install nltk scikit-learn pandas
# β¦