# Kinyarwanda-language-model
Reproducible pipeline for preparing, training, adapting, and aligning a Montreal Forced Aligner (MFA) acoustic model for Kinyarwanda.
Kinyarwanda is spoken by 12M+ people, yet high-quality ASR/aligner resources are limited. This repo shows how to go from **raw Kaggle data → cleaned text + audio → pronunciation dictionary → MFA training/adaptation → alignments**, with everything scripted in Jupyter notebooks.
## Data sources
- **Kaggle:**Kinyarwanda Automatic Speech Recognition — Track B (1000h)
Dataset released by Digital Umuganda, funded by the Gates Foundation.
---
## Environment Setup
### 1. Install Python
- Recommended versions: **Python 3.9 – 3.11**
- Use **Conda** or **venv** to keep the environment isolated.
- Check your version: ```python --version```
### 2. Install Montreal Forced Aligner (MFA)
For this pipeline, **Conda** is used (the recommended method in MFA docs).
```bash
conda create -n aligner -c conda-forge montreal-forced-aligner
conda activate aligner
mfa version
```
Reminder: Always run ```conda activate aligner``` before using MFA.
If you prefer Docker or source install, see the MFA documentation.
### 3. Install Jupyter Notebook
To run preprocessing and cleaning scripts interactively:
```bash
pip install notebook
jupyter notebook
```
### 4. Install Python Libraries
These are needed for the preprocessing scripts and notebooks:
```bash
pip install pandas numpy tqdm regex textgrid praat-parselmouth epitrans panphon
```
### 5. Install FFmpeg (for audio conversion)
MFA requires audio in .wav format.
If your dataset is in .webm (as in Kaggle), install FFmpeg:
- macOS (Homebrew): ``` brew install ffmpeg ```
- Ubuntu/Debian: ``` sudo apt-get install ffmpeg ```
---
## Pipeline (Notebooks)
### Step 1 – Import & Clean Transcriptions
**Notebook: `notebooks/01_import_and_clean.ipynb`**
- Convert `train.json` → `train.csv` (≈180k rows, 14 columns)
- Define Kinyarwanda orthographic units (letters + multi-character …