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.

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.

🪟
Windows TSF Layer
bangla_tsf.dll — An in-process COM DLL that intercepts keystrokes via the Windows Text Services Framework and delivers them to the language engine.
⚙️
Core Language Engine
A pure C++20 library handling phonetic parsing, lexicon lookup, context ranking, personal dictionary, and Unicode generation. Platform-independent.
Keyboard InputWindows 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

Every keystroke, explained.

1
You press a key

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.

Key pressed: a
2
Roman input is buffered

Each character is appended to an internal composition buffer. As you continue typing, the buffer grows — aamami — with inline Bengali preview appearing in the document for each state.

Buffer: a Buffer: am Buffer: ami
3
Phonetic parser generates candidates

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.

ami → candidates: আমি , আম , অমি
4
Candidates are ranked

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
5
Suggestion bar appears

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.

6
You commit the word

Press Space to commit the top candidate (with a space appended), or press 15 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.

Space pressed → আমি (committed to document)

Keys at a glance.

Key / Action What Likhi Does
az, AZAppends Roman character, updates candidates and inline preview
SpaceCommits top candidate (or selected candidate) + space into document
EnterCommits current candidate and terminates composition
15Commits the corresponding numbered candidate directly
/ ArrowNavigates highlight across candidates in the suggestion window
BackspaceDeletes last Roman character; grapheme cluster rollback in Bengali buffer
EscapeCancels active composition without committing text
. (Period)Commits active word and inserts Bengali Dāri ()
Win + SpaceWindows language switcher — switch between Likhi and English mode
Ctrl+C, Ctrl+V, etc.Pass through directly — Likhi never intercepts system shortcuts
F1F12, NumpadPass through natively — not consumed by Likhi
Mouse click on candidateCommits the clicked candidate to the document
Full Typing Guide → Keyboard Shortcuts Reference