How nama-researchlab/sema works
Sema is an offline Swahili understanding and speech library. Its forward workflow resolves Swahili words through the lexicon and affix rules, races parse strategies, then linearizes meaning into telegraphic English for an external model. On the return path, structured intent is synthesized into Swahili, while the render layer supports bilingual output from glosses. The CLI exposes library operations as JSON. The README documents additional capabilities whose internal wiring is not fully shown in the sampled source; those links are omitted where uncertain.
Main entry points: sema_cc.rs JSON CLI · lexicon.rs Lexicon lookup · linearizer.rs Sentence linearizer · racer.rs Parse cascade
Components 14
Interfaces
- JSON CLI
src/bin/sema_cc.rs
Forward Understanding
- Lexicon lookup
src/lexicon.rs - Parse cascade
src/racer.rs - Sentence linearizer
src/linearizer.rs - Sentence roles
src/linearizer.rs
Swahili Output
- Intent synthesis
src/rolodex.rs - Back-pass engine
src/backpass.rs - Bilingual renderer
src/render.rs
Language Data
- Affix resolver
src/affix/mod.rs - Distilled lexicon
data/swahili.distilled.jsonl - Synthesis rules
src/affix/sw.toml
Other components
- Swahili user
- English model
- Sema-Tena engine
Connections 18
- Swahili user → JSON CLI: submits text or intent
- JSON CLI → Lexicon lookup: loads and queries
- Lexicon lookup → Distilled lexicon: reads entries
- Lexicon lookup → Affix resolver: tries affixes
- JSON CLI → Parse cascade: races sentence
- Parse cascade → Lexicon lookup: resolves words
- Parse cascade → Sentence linearizer: decomposes verbs
- JSON CLI → Sentence linearizer: linearizes sentence
- Sentence linearizer → Sentence roles: assigns roles
- Sentence linearizer → English model: returns telegram
- English model → JSON CLI: provides structured intent
- JSON CLI → Intent synthesis: synthesizes intent
- Intent synthesis → Back-pass engine: uses synthesis
- Back-pass engine → Synthesis rules: loads rules
- Back-pass engine → Sema-Tena engine: delegates synthesis
- JSON CLI → Bilingual renderer: renders bilingual output
- Bilingual renderer → Lexicon lookup: builds gloss index
- Bilingual renderer → Swahili user: returns Swahili output