Logo Lanfrica

onpointsoft-solutions/Kiswahili-kikuyu-Translator

Domain:

natural language processing

Record type:

modelsoftware
Creator:
onp
Host:
# 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 …