# Kabras AI Translator
A speech translation app for the **Kabras language** β a Luhya dialect spoken in Western Kenya. Built to support language preservation through accessible AI tooling.
## Features
- ποΈ Live microphone recording or audio file upload
- π Exact and fuzzy matching against a growing Kabras lexicon
- π Confidence scoring with top alternative matches
- π Dual logging to JSON and CSV for research use
- β In-app lexicon expansion with duplicate detection
- π Admin gap analysis β surfaces most-needed phrases by frequency
- π€ Export translation history as JSON or CSV
## Project structure
```
kabras-ai-project/
βββ app/
β βββ gradio_app.py # Main Gradio UI and all logic
β βββ main.py # Entry point β run this
β βββ lexicon/
β β βββ kabras_lexicon.json
β βββ datasets/
β β βββ translations_log.csv # Auto-generated on first translation
β βββ config/
β βββ settings.yaml
βββ docs/
β βββ README.md
βββ requirements.txt
```
## Setup
```bash
git clone
github.com
cd kabras-ai-project
python -m venv .venv
.venv\Scripts\activate # Windows
pip install -r requirements.txt
```
## Run
```bash
python app/main.py
```
Then open
127.0.0.1 in your browser.
## How it works
1. Audio is captured via microphone or file upload
2. Google Speech Recognition transcribes it (Swahili first, English fallback)
3. The transcription is matched against `kabras_lexicon.json`:
- **Exact match** β 100% confidence
- **Fuzzy match** (β₯ 62% similarity) β confidence score + alternatives shown
- **No match** β logged and flagged for lexicon expansion
4. Every attempt is logged to `datasets/translations_log.csv`
## Research companion
This app generates the dataset used by the
kabras-asr-research
project for WER analysis and confidence visualisations.
## Contributing
To add new Kabras phrases, use the **Expand Lexicon** tab in the app,
or edit `lexicon/kabras_lexicon.json` direct β¦