Lekhani
A cross-platform input engine in Rust, with native apps for Linux, Windows and Android.
Bengali phonetics shouldn't drop frames or freeze UI threads
Bengali orthography consists of 50 letters, 11 vowel diacritics, and over 250 conjunct consonant ligatures (*যুক্তবর্ণ*). Most software keyboards run on heavy Electron/V8 runtimes or legacy C++ runtimes that allocate dynamic memory on every keystroke, introducing 8.6ms latency spikes and misparsing vowel-consonant order during fast typing.
Suggestions must render in under 1ms on the main UI thread before the user strikes the next key.
Identical romanized key sequences produce 100% byte-for-byte identical output across Linux, Windows, and Android.
Stack-allocated circular slice buffers eliminate hot-path allocator pressure and garbage collection jitter.
Interactive WebAssembly Transliteration Sandbox
Architecture
Shared logic lives in pure Rust crates with zero platform UI dependencies. Each client only implements a thin native interface layer.
Lekhani Zero-Allocation Pipeline
Follow raw hardware keystrokes through pure Rust crates to sub-millisecond IME commit
AST Syllable Parser — Phonetic Conjunct Segmenter
Structures phoneme tokens into linguistic syllables, automatically applying Hasanta viramas (হসন্ত), vowel matras (া, ি, ী), and conjunct ligatures (ক্ষ, জ্ঞ, ঙ্গ).
Key decisions & Trade-offs
Word-level vs Syllable-level Modeling
Deterministic Dictionary vs Probabilistic Intent
Single Pure Rust Core vs Platform Native Rewrites
Testing and benchmarks
Same text corpus (100,000 sentences from Prothom Alo and Wikipedia), same machine (Fedora Linux, Intel Core i7).
| METRIC | LEKHANI (RUST) | AVRO PHONETIC | DELTA |
|---|---|---|---|
| Average Keystroke Latency | 0.42 ms | 8.60 ms | 20.5x faster |
| Correction Rate per 100 Words | 3.2 words | 18.5 words | -79% corrections |
| Peak Memory Footprint | 14.8 MB | 62.1 MB | 76% leaner |
Hot-Path Telemetry & Micro-Profiler
CPU call stack & sub-millisecond execution budget (0.42 ms total)
cargo bench --bench phonetic_comparisonStatus, honestly
- Core phonetic parsing AST
- IBus & Fcitx5 Linux daemons
- Android Compose IME
- Standalone crates on crates.io
- ~Neural next-word prediction
- ~Local quantized ONNX inference
- ~Slint Windows TSF IME provider
- •macOS InputMethodKit backend
- •Cloud-free personal dictionary sync
- •Wayland text-input-v3 native bridge