How It Works
From keystroke to
Bengali text.
Likhi works as a native Windows Input Method (IME). Here's exactly what happens from the moment you press a key to when Bengali text appears in your document.
The Engine
Two layers working together.
Likhi is split into two strictly separated subsystems. The core language engine is a pure C++20 library that has zero Windows dependency — it can be tested and benchmarked independently. The Windows layer wraps it in a TSF COM DLL.
bangla_tsf.dll — An in-process COM DLL that intercepts keystrokes
via the Windows Text Services Framework and delivers them to the language engine.
Keyboard Input ↓ Windows TSF Input Layer (COM InProcServer DLL) ↓ Input Composition Buffer (Roman characters accumulated) ↓ Bengali Transliteration Engine (Phonetic Parser + Unicode Grammar) ↓ Candidate Generator (Compact Binary Trie · 80,196 word Lexicon) ↓ Context & Linguistic Ranker (Unigram + Bigram + Personal Dict) ↓ Suggestion UI (Lightweight Win32 Overlay · DirectWrite) ↓ Bengali Text Committed → Your active application
Step by Step
Every keystroke, explained.
When you type a Roman letter (e.g. a), Likhi's TSF
ITfKeyEventSink intercepts the keystroke before it reaches the application.
System shortcuts like Ctrl+C, F5, and Win are always
passed through — Likhi only processes normal alpha-numeric composition characters.
Each character is appended to an internal composition buffer. As you continue typing,
the buffer grows — a → am → ami — with
inline Bengali preview appearing in the document for each state.
The transliteration engine performs a multi-candidate beam search across Bengali phoneme combinations. It generates all plausible Bengali Unicode representations of the Roman input, including Banglish spelling variants.
Each candidate is scored using a log-linear model combining:
- Phonetic match score — how well the Roman input maps to this Bengali word
- Unigram frequency — how common this word is in the lexicon
- Bigram context — how likely this word follows the previous committed word
- Personal dictionary boost — user-added words score higher
A lightweight native Win32 popup window (rendered with DirectWrite) shows up to 5 ranked candidates near your cursor. The top candidate appears in-line as a composition preview in your document.
Press Space to commit the top candidate (with a space appended), or press 1–5 to pick a specific candidate. The Bengali text is written to your document via TSF's edit session API. The composition buffer resets, ready for the next word.
Keyboard Reference
Keys at a glance.
| Key / Action | What Likhi Does |
|---|---|
| a – z, A – Z | Appends Roman character, updates candidates and inline preview |
| Space | Commits top candidate (or selected candidate) + space into document |
| Enter | Commits current candidate and terminates composition |
| 1 – 5 | Commits the corresponding numbered candidate directly |
| ↑ / ↓ Arrow | Navigates highlight across candidates in the suggestion window |
| Backspace | Deletes last Roman character; grapheme cluster rollback in Bengali buffer |
| Escape | Cancels active composition without committing text |
| . (Period) | Commits active word and inserts Bengali Dāri (।) |
| Win + Space | Windows language switcher — switch between Likhi and English mode |
| Ctrl+C, Ctrl+V, etc. | Pass through directly — Likhi never intercepts system shortcuts |
| F1–F12, Numpad | Pass through natively — not consumed by Likhi |
| Mouse click on candidate | Commits the clicked candidate to the document |