Simulating Input Methods
Use a composition table when counting the keys needed to type a corpus depends on what the input method has pending. This lets analysis account for sequences that emit no text until a later press, such as rōmaji-to-kana input or Hangul assembly.
For a candidate-based IME, analyze the input the typist supplies for lookup when the corpus provides that input form. Rime Pinyin and Century Cangjie (五倉世紀) model entry of the spelling or code. They do not simulate which candidates appear, how they are ranked, or what the typist selects or confirms.
Commit Text and Leave a Key Pending
Section titled “Commit Text and Leave a Key Pending”While typing “っか” in QWERTY (Mozc), the second press commits one character and leaves the start of the next pending:
[composition.transitions]"" = { k = { commit = "", next = "k" } }k = { a = "か", k = { commit = "っ", next = "k" } }Each entry in composition.transitions may use commit together with next.
A word ending with a single N in Mozc shows why the pending display can differ from the committed text. After
[composition.states]"n" = { final_text = "ん" }A state’s final_text gives its end-of-input output without changing its display.
If the layout should reject unfinished sequences instead of committing their pending display by default, set composition.commit_on_exit to false.
Fields
Section titled “Fields”| Field | Use |
|---|---|
composition.transitions | Define one outcome per state and key. "" names the start state. A bare key ID means base layer; quote a non-base input as "layer_id key_id". |
| String outcome | Commit that text and return to the start state. |
{ next = "state" } | Enter a state without committing text. |
{ commit = "text", next = "state" } | Commit text and enter the named state on the same press. |
composition.states.<state>.display | Set the visible pending text instead of showing the state name. |
composition.states.<state>.final_text | Specify the text to commit on exit without changing the pending display. |
committed_state | On a transition that commits and enters a nonempty state, choose which earlier pending state marks the end of the committed text’s input for Trace. Use a state name or false to hide that boundary. It changes neither output nor scores. |
composition.commit_on_exit | Set to false to reject unfinished states that do not specify their own final text. The default is true. |
Without an explicit committed_state, Trace looks for one earlier pending-state visit with display text matching the committed output. When you name a state, it must reach the commit without an intervening commit or return to the start; the replay must show exactly one matching visit since the previous commit. If Trace cannot prove a unique boundary, it does not draw it.