# π£οΈ Lost in Darija
π **Try it live on HuggingFace Spaces**
A speech-to-speech translation pipeline that converts spoken English into Moroccan Darija, designed for tourists navigating Morocco.
π **Read the full write-up** how a model that scored 18.30 BLEU on its own test set dropped to 10.23 on an independent benchmark, what that revealed about the data, and the engineering lessons from building the fix.
---
## β¨ Features
- ποΈ **Speech-to-Text** β transcribes English audio using OpenAI Whisper
- π **Neural Machine Translation** β translates English to Moroccan Darija using a fine-tuned MarianMT model (Helsinki-NLP/opus-mt-en-ar)
- π **Text-to-Speech** β synthesizes Darija audio using Microsoft Edge TTS (ar-MA-JamalNeural voice)
- π **BLEU score evaluation** β measures translation quality on a test set (BLEU = 18.30 after 8 epochs)
---
## π¬ Example
| Input (English) | Output (Darija, Arabic script) |
|---|---|
| "Excuse me, can you help me find a good restaurant?" | Ψ³Ω
Ψ ΩΩΨ§, ΩΨ§Ψ΄ ΨͺΩΨ―Ψ± ΨͺΨΉΨ§ΩΩΩ ΩΩΩΩ Ψ΄Ω Ψ±ΩΨ³Ψ·ΩΨ±Ψ© Ψ²ΩΩΩΨ©? |
## ποΈ Project Structure
```
lost-in-darija/
βββ data/
β βββ Train.csv # Training set (eng β darija_ar)
β βββ Val.csv # Validation set
β βββ Test.csv # Test set
β βββ sentences.csv # Sample sentences
βββ notebooks/
β βββ notebook.ipynb # Experimentation notebook
βββ src/
β βββ pipeline.py # End-to-end pipeline (STT β Translation β TTS)
β βββ stt/
β β βββ transcribe.py # Whisper transcription
β βββ translation/
β β βββ fine_tune.py # MarianMT fine-tuning script
β β βββ translate.py # Inference with fine-tuned model
β β βββ evaluate.py # BLEU score evaluation
β βββ tts/
β βββ synthetise.py # Edge TTS synthesis
βββ tests/
β βββ test_pipeline.py
βββ requirements.in # Direct dependencies (source)
βββ requirements.txt # Pinned dependencies (generated by pip-compile)
βββ app.py # Gradio web interface
βββ evaluate_terjama.py # β¦