Sovereign Swahili language primitives — pronunciation, morphology, read-aloud scoring. Zero-dependency, offline. By Laetoli (T) Limited.
# @laetoli/lugha
**Sovereign Swahili language primitives.** Zero-dependency, offline, deterministic
building blocks extracted from the Kasuku platform so any
product can embed Tanzania's language layer instead of a foreign cloud LLM.
- **Pronunciation** — `phonemize` (syllables, IPA, ASCII respelling) + `transliterate`
- **Morphology** — `conjugate` / `paradigm` (verb across persons & tenses) + noun classes
- **Read-aloud scoring** — `scoreReading` (phoneme-aware, per word: good / close / miss)
- **Editorial** — `audit` (clarity, style, repetition, show-don't-tell, Kiswahili register, 0–100 score)
- **Poetry** — `analyzePoem` (arudhi: mizani + vina/rhyme scheme)
- **Dictionary (Kamusi)** — `define` / `toSwahili` / `toEnglish` (1,414 meanings, WOLD CC-BY)
No model, no network, no API keys. Standard Swahili is ~95% phonetically regular
and agglutinatively regular, so these are encoded as rules.
> The catalogue-bound features (book discovery, literary study guides) and the
> neural voice / ASR live in the Kasuku app — they need its data and a browser.
> This package is the pure, portable core.
## Install
```bash
npm install github:nooher/kasuku-lugha
```
## Use
```ts
import { Lugha } from '@laetoli/lugha';
Lugha.phonemize('karibu');
// { word:'karibu', syllables:['ka','ri','bu'], ipa:'/kɑˈɾibu/', respell:'ka-REE-bu', stress:1 }
Lugha.transliterate('asante sana'); // smooth form a generic TTS voice reads as Swahili
Lugha.conjugate('soma', 'present'); // [{ pronoun:'mimi', form:'ninasoma', ... }, ...] (6 persons)
Lugha.conjugate('soma', 'present', true);// negative: 'sisomi' ...
Lugha.scoreReading('asante sana', heardText); // { overall, words:[{word,status,sim,syllables}] }
```
Named exports are also available: `phonemize`, `ttsText`, `paradigm`, `conjugate`,
`scoreReading`, `NOUN_CLASSES`, `LUGHA_VERSION`, plus all the types.
| Function | Returns |
|---|---|
| `phonemize(text)` | `{ syllables, ipa, respell, stress }` |
| `transliterate(text)` / `tts …