Skip to content

Release 0.0.6-beta.1: precompiled Rime, stroke keyboard, fuzzy switches, pre-edit fixes - #130

Merged
Slacker-LLC merged 10 commits into
mainfrom
feat/prebuilt-rime
Oct 5, 2026
Merged

Slacker-LLC merged 10 commits into
mainfrom
feat/prebuilt-rime

Conversation

@Slacker-LLC

@Slacker-LLC Slacker-LLC commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Rime dictionaries precompiled at build time (prebuildRimeData, scripts/build_rime_prebuilt.py): a host build of the vendored librime compiles rime-data; the APK ships the tables as rime-data/build and drops the compile-only sources (APK −4.0 MB, on-device Rime data 79 → 42 MB). Fresh install to librime ready: 60.1 s → 2.7 s (API 36 emulator), 1.7 s (Xiaomi 15). A content hash (rime-data.revision) skips the copy on upgrades that leave the data unchanged.
  • Stroke (笔画) keyboard: 一 丨 丿 丶 乛 and 通配 in the nine-key frame; characters from a build-time table ranked by the 8105 frequencies, exact stroke orders first, glyphs the font cannot draw dropped; choices learned locally.
  • Fuzzy pinyin: master switch plus 11 per-pair switches (z/zh c/ch s/sh n/l f/h r/l an/ang en/eng in/ing ian/iang uan/uang), all off by default. FuzzyRule holds librime algebra and Kotlin mapping (unit test checks they agree on every syllable); user rules shadow openime_fuzzy.yaml, a change starts librime with a full check.
  • Chinese pre-edit stays on the keyboard: pinyin / nine-key digits / strokes are no longer set as the app's composing text (QQ/WeChat showed "669", "ni'hao"). English still composes in place. The gateway tracks its own composing span and its own commits' selection updates.
  • Fixes: swipe-up clear repeated the text in editors with stale in-batch reads (Minis); English words commit with a space; first nine-key candidate no longer clipped (0.0.5).
  • UI: 符号 key on nine-key/stroke; 重输 styled like 删除/确定; editable symbol rail (ten defaults, + opens RailSymbolsActivity, part of the archive); keyboard switcher uses the 工具 tile grid.
  • Removed for now: voice word lists (hotword), kept on archive/voice-word-lists.
  • Version 0.0.6-beta.1 (versionCode 601), CHANGELOG updated.

Test plan

  • Unit tests and lint
  • Full instrumented suite on the API 36 emulator: 131 tests pass (new: prebuilt tables, fuzzy switches reach librime, rail editor)
  • scripts/typing_stress_e2e.py with real touches, emulator and Xiaomi 15: 拼音 26 键 61, 九键 61, 笔画 56, 英文 75, 数字 60, mixed 88 characters; pre-edit never reaches the field; no crash, ANR or process restart
  • Swipe-up clear verified in Minis on the emulator

🤖 Generated with Claude Code

Slacker-LLC and others added 2 commits October 5, 2026 13:44
librime compiled every dictionary on the phone after each install or
upgrade: about a minute (over fifteen on CI's software emulator) with only
the Kotlin fallback lexicon available.

prebuildRimeData now builds the vendored librime's deployer for the host,
compiles rime-data at build time, and adds the tables to the APK as
rime-data/build, librime's prebuilt data dir. The output is byte-identical
to what librime compiles on device. The dictionary sources that only the
compiler reads stay out of the APK, so it shrinks by about 4 MB.

Without sources librime cannot tell a stale staged table from a current
one, so a new APK also clears user/build (the user dictionary is beside it,
untouched), and startup crash recovery restores the prebuilt tables
instead of deleting them.

Fresh install to librime ready: 60.1 s -> 2.7 s on the API 36 emulator,
1.7 s on a Xiaomi 15.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Slacker-LLC Slacker-LLC changed the title Ship Rime dictionaries precompiled instead of compiling on the phone Release 0.0.6-beta.1: Rime dictionaries precompiled at build time Oct 5, 2026
Slacker-LLC and others added 8 commits October 5, 2026 14:14
The build writes a SHA-256 of the packaged Rime data (sources, compiled
tables, and the names kept out of the APK) to rime-data.revision; the
phone copies again only when it changes. The ready log now reports the
copy and native startup times.

Emulator: upgrade with new data copy=357ms native=1387ms; upgrade with
unchanged data copy=skipped native=236ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Five stroke keys and 通配 in the nine-key frame. Characters come from a
table generated at build time from Rime's stroke dictionary, ranked by the
8105 table's frequencies: exact stroke orders first, then longer ones;
通配 stands for one stroke. Choices are learned locally by stroke code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Homophone replacement is not good enough to ship. The hotword package,
its built-in lists, management page and 26-key boost are removed; the
code is kept on archive/voice-word-lists (f3bb5cc). Imported list files
stay on the phone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…witcher

- Nine-key and stroke keyboards get the numeric keyboard's 符号 key under
  the symbol rail.
- 重输 always looks like 删除 and 确定; it does nothing with no input.
- The rail shows the user's list (ten common marks by default) and ends
  in +, which opens RailSymbolsActivity to add, reorder and remove them.
  The list is part of the user-data archive.
- The keyboard switcher uses the 工具 tile grid, one icon per keyboard;
  stroke candidates the system font cannot draw are dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Eleven pairs as in mainstream IMEs (z/zh c/ch s/sh n/l f/h r/l, an/ang
en/eng in/ing ian/iang uan/uang), all off by default. FuzzyRule holds
each pair as librime algebra and as the Kotlin mapping; a unit test checks
they agree on every syllable. The fuzzy schema patches in
openime_fuzzy:/rules; the user dir copy written from the switches shadows
the shipped one, and a changed file starts librime with a full check
(the quick check works on whole-second mtimes and missed same-second
edits). Switches are part of the user-data archive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clear-all's surrounding-text fallback ran inside a batch edit. Editors
such as Minis (Compose) answer reads in a batch from the state before it,
so the loop never saw its deletions, hit its round limit and 'restored'
every round's text, repeating the document. The fallback now runs outside
the batch, stops when a read shows no change, and only restores text it
saw disappear. Two fake-editor tests reproduce both behaviours.

English 26-key commits now end in a space, as on Gboard and Sogou.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pinyin, nine-key digits and strokes were also set as the app's composing
text, so QQ and WeChat showed '669' or ni'hao in their field and offered
stickers for it. Chinese layouts now keep the pre-edit on the keyboard,
as Sogou and iFlytek do; English still composes in place. The gateway
tracks whether it owns a composing span (a cancel without one could
delete a selection) and marks selection updates caused by its own
commits, which would otherwise drop the rest of a partially committed
pre-edit.

scripts/typing_stress_e2e.py taps real key positions to type 50+
characters on every keyboard and a mixed session, and checks the text,
that the pre-edit never reaches the field, and that nothing crashed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cancelComposing takes owned=true from voice paths that know a partial of
theirs is in the editor. The fuzzy test shuts down a librime session the
in-process IME may hold and removes what it staged; the prebuilt test
starts from a clean staging dir. Typing stress script: --package for a
suffixed debug build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Slacker-LLC Slacker-LLC changed the title Release 0.0.6-beta.1: Rime dictionaries precompiled at build time Release 0.0.6-beta.1: precompiled Rime, stroke keyboard, fuzzy switches, pre-edit fixes Oct 5, 2026
@Slacker-LLC
Slacker-LLC merged commit 72d8247 into main Oct 5, 2026
7 checks passed
@Slacker-LLC
Slacker-LLC deleted the feat/prebuilt-rime branch October 5, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant