Logo Lanfrica

onpointsoft-solutions/Kiswahili-kikuyu-Translator

Domaine:

natural language processing

Type de record:

modelsoftware
Créateur:
onp
Hôte:
# Kiswahili to Kikuyu Translation Model This project implements a state-of-the-art neural machine translation system for translating between Kiswahili (Swahili) and Kikuyu languages, utilizing transformer-based architecture via the Hugging Face Transformers library. ## 🚀 Quick Start ```bash # Clone the repository git clone github.com cd Kiswahili-kikuyu-Translator # Install dependencies pip install -r requirements.txt ``` ## 📚 Data Preparation ### Using Separate Text Files (Recommended) 1. Place your Kiswahili and Kikuyu text files in the `data/raw` directory: - Each file should contain one sentence per line - Files must have the same number of lines with corresponding translations 2. Run the preparation script: ```bash python src/main.py prepare --kiswahili_file data/raw/kiswahili.txt --kikuyu_file data/raw/kikuyu.txt ``` ### Using Parallel Corpus (Alternative) 1. Place your parallel corpus in the `data/raw` directory - Format: one sentence pair per line, separated by a tab 2. Run the preparation script: ```bash python src/main.py prepare --input_file data/raw/sw_ki_parallel.txt ``` ## 🏋️ Training Train the translation model: ```bash python src/train.py \ --train_file data/processed/train.csv \ --validation_file data/processed/validation.csv \ --source_lang sw \ --target_lang ki \ --output_dir models/sw-ki-translation \ --num_train_epochs 10 \ --learning_rate 5e-5 ``` ## 📊 Evaluation Evaluate the trained model: ```bash python src/evaluate.py \ --model_dir models/sw-ki-translation \ --test_file data/processed/test.csv ``` ## 🔄 Translation Translate Kiswahili text to Kikuyu: ```bash python src/translate.py \ --model_dir models/sw-ki-translation \ --input_text "Habari ya asubuhi" \ --output_file translations.txt ``` Or use interactive mode: ```bash python src/translate.py --model_dir models/sw-ki-translation --interactive ``` ## 🤖 Model Architecture The system utilizes the transform …