Skip to main content

TLL — Tanzania Local Language

TLL is a Python library ecosystem for Tanzanian local-language technology. The project starts with Kiswahili (sw) and Kisukuma (suk) and is designed to support additional Tanzanian languages without rewriting the core architecture.

This repository currently focuses on the foundational pieces required for a serious, reusable library:

  • language registry
  • dataset provenance and validation
  • raw/cleaned/reviewed/verified data pipeline
  • dictionary-oriented data access
  • translation API with conservative behavior
  • text normalization and tokenization hooks
  • CLI and documentation scaffolding

Important: some features are intentionally scaffolded and documented as future work rather than pretending they are fully implemented.

Quick start

PowerShell:

python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -e .

To install the published package from PyPI:

pip install Tan_language

The package includes the cleaned Sukuma dataset needed by the dictionary translation API, so LOCAL_LANGUAGE and the repository's root data/ folder are not required after installation.

Then:

from tll import get_language, list_languages

print(get_language("suk").name)
print([lang.code for lang in list_languages()])

Translation and chatbot usage

The translation API now uses the dataset-first algorithm from the LOCAL_LANGUAGE project:

  1. exact match
  2. word-by-word composition for phrases
  3. fuzzy spelling match
  4. explicit "not found" response instead of invented translations

PowerShell examples:

tan-language translate --from suk --to sw mwalimu
tan-language translate --from suk --to sw "mwalimu shule"
tan-language chat --from suk --to sw mwalimu

Python usage:

from tll import LocalLanguageChatbot, Translator

translator = Translator(source="suk", target="sw")
print(translator.translate("mwalimu shule"))

chatbot = LocalLanguageChatbot(language="suk")
print(chatbot.chat("mwalimu", source_language="suk", target_language="sw"))

The chatbot is grounded in the local dataset. grounded=True means the response came from a dataset match; a grounded=False response must be reviewed by a native speaker and should not be treated as a verified translation.

Optional offline LLM chatbot

For natural conversation, install the optional GGUF runtime:

pip install "Tan_language[local-llm]"

The first LLM request downloads the small Qwen instruct GGUF model into the Hugging Face cache. Later requests reuse that file and run locally without network access. Model weights are intentionally not included in the wheel. To pre-download or use a model file managed by your organization, pass its local path:

tll chat --llm --model-path .\models\assistant.gguf --from suk --to sw "Habari?"

Or use Python:

from tll import LocalLanguageChatbot

bot = LocalLanguageChatbot(backend="llm")
print(bot.chat("Habari?", source_language="sw", target_language="sw")["response"])
bot.reset()  # clear conversation history; the model stays loaded

Generation is deterministic by default (temperature=0, fixed seed). The LLM is not a verified translation engine: responses have grounded=False and should be reviewed for language accuracy.

Current validation workflow

python scripts/validate_dataset.py --dataset data/raw/suk/sukuma_deduplicated.csv

This validates the provided Kisukuma dataset without modifying the original raw file.

Reviewed and verified dataset workflow

python scripts/review_dataset.py --input data/cleaned/suk/cleaned_sukuma_dataset.csv --output-dir data/reviewed/suk --language suk

This creates the reviewed stage and then promotes the verified subset into a dedicated verified dataset. The library keeps all intermediate data, so the raw source remains untouched and the review decisions remain auditable.

Project status

This is Phase 1 of the roadmap: dataset inspection, architecture, language registry, and validation. The cleaning stage begins only after validation is complete and reviewed.

License

This project is licensed under the MIT license. Dataset licenses are handled separately and must be recorded carefully; if unknown, the metadata must state unknown.

Release files for Tan-language 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Tan-language 0.1.0
File Size Uploaded
tan_language-0.1.0.tar.gz 454.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Tan-language 0.1.0
File Interpreter ABI Platform
tan_language-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 957.1 kB

Release files / tan_language-0.1.0.tar.gz

Download URL tan_language-0.1.0.tar.gz
Size 454.9 kB
Tags Source
SHA-256 checksum
How to use checksums
99a5dc15d9548c0f42e8a0073d5a25f93f8137dcecb1fcc54f232551c1da6027
BLAKE2b-256 checksum
How to use checksums
95d5807708ff0578643d1387f488b27a853cb0c1f326d84647ccb9016e2d6fa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / tan_language-0.1.0-py3-none-any.whl

Download URL tan_language-0.1.0-py3-none-any.whl
Size 502.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4989d62be751da20a8fb032aa5f0da3cb4761cf0e6fed6923710b299c38e93bd
BLAKE2b-256 checksum
How to use checksums
2d1bd19609ece42afe779ae1a86eb501825e3a3b5c982d3dc5545460ea74ae99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page