A neural machine translation system for Hassaniya Arabic dialect spoken in Mauritania to English, built with PyTorch and Seq2Seq architecture with attention mechanism.
# Hassaniya-Translator
# 🌙 Hassaniya-Bridge: Neural Machine Translation for Hassaniya Arabic
A neural machine translation system for Hassaniya Arabic (a Maghrebi Arabic dialect spoken in Mauritania and Western Sahara) to English, built with PyTorch and Seq2Seq architecture with attention mechanism.
## 🌟 Project Overview
**Hassaniya-Bridge** aims to bridge the language gap for one of the world's under-resourced languages. Hassaniya Arabic, spoken by over 3 million people across West Africa, has minimal digital presence and virtually no machine translation support. This project represents a step toward digital inclusion and language preservation.
### Why This Matters
- 🗣️ **Language Preservation**: Hassaniya is an oral tradition language with limited written resources
- 🌍 **Digital Inclusion**: Enables Hassaniya speakers to access global information
- 📚 **Research Foundation**: First open-source NMT system for this dialect
- 🤝 **Cultural Bridge**: Connects Hassaniya-speaking communities with the wider world
## ✨ Features
- ⚡ **Seq2Seq with Attention**: LSTM-based encoder-decoder with Bahdanau attention
- 📊 **Custom Vocabulary Builder**: Handles Arabic script and dialect-specific terms
- 🎯 **Teacher Forcing**: Accelerated training with configurable forcing ratio
- 💾 **Model Checkpointing**: Automatic saving of best models
- 📈 **Training Visualization**: Real-time loss tracking and metrics
- 🔍 **Inference Pipeline**: Easy-to-use translation interface
## 🚀 Quick Start
### Prerequisites
```bash
python >= 3.8
torch >= 2.0.0
numpy >= 1.21.0
matplotlib >= 3.5.0
```
### Installation
```bash
# Clone the repository
git clone
github.com
cd hassaniya-bridge
# Install dependencies
pip install -r requirements.txt
```
### Basic Usage
```python
from model import Seq2Seq, Encoder, Decoder, Attention
from utils import translate_sentence
# Load trained model
model = torch.load('best_model.pt')
# Translate a sentence
hassa …