Repository navigation
feat(android-ime): keyboard data export, fuzzy pinyin and separate learning stores (depends on #1230) - #1236
Draft
DepengWang wants to merge 6 commits into
Draft
DepengWang wants to merge 6 commits into
DepengWang wants to merge 6 commits into
Conversation
…oke and English Rebased onto the Rime pinyin backend (Open-Less#1196): the LitePinyin changes (full-pinyin phrase index, combo learning) are dropped; what remains applies to the stroke and English keyboards and to the pinyin row's association and candidate plumbing that Rime still uses. Associations - Drop the phrase the context already completes from the association results, so the row clears once the last association is picked. - Clear associations (and the stroke code row) when the host empties the field, e.g. a chat app's send button. - Rank associations the user picked before ahead of unpicked ones; typing an offered association out by hand counts as picking it (stroke, and Rime commits through RimePinyinController's association context). Replaces the stroke commit record whose key never matched an association lookup. Stroke - Mark, digit, space and Return keys drop the half-typed code, its segments and the code row before committing; a new input session clears the code row and candidates on screen too. - Keep recording picks of a character that is on top only because of earlier picks, so its score stays fresh. English - Sentence punctuation replaces the space a candidate pick added. - A quick double space after a word becomes ". ". - Capitalize at the start of a sentence, line or field (not in email, URL, password or number fields); Shift turns an automatic capital off. Speed - Stroke dictionary sorted by frequency once at load; a query puts the user's picks first and stops at 36 matches instead of scoring and sorting up to ~48k entries (first stroke now 0-2 ms on a OnePlus). - Usage stores parsed into one process-wide in-memory cache, kept current by a preference listener. - Shift changes relabel the English keys in place instead of rebuilding the keyboard; the English/pinyin candidate row reuses its views. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… open With Open-Less#1187's draft bar open, typing goes to the draft box, so an empty host field must not clear the stroke code row or the associations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iations Guard candidate spaces and double-space full stops with editor and selection anchors. Retain typed continuation boundaries so separately committed characters train the originally offered association. Add JVM and Android emulator regressions plus safe CI evidence collection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Invalidate confirmed association text and continuation history when Pinyin Backspace deletes editor text without an active composition. Add an asynchronous service regression for stale-context learning. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Complete cold dictionary deployment on the instrumentation test thread before exercising the editor fallback, matching the existing Rime integration test setup. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
DepengWang
force-pushed
the
feature/ime-pinyin-learning-portability
branch
2 times, most recently
from
October 19, 2026 14:51
d83910a to
25933f4
Compare
…arning stores Keyboard settings page: - "Export / Import keyboard data": one JSON file with this page's preferences (keyboard size, haptics, switches, fuzzy pinyin), the Rime pinyin user dictionary, stroke ranking, association learning and the cloud notes webhook. Each part is chosen in a checklist; settings are replaced, learning data is merged (higher count and later use win). It is independent of the migration bundle and cloud sync. - Fuzzy pinyin: seven pairs from rime-ice's own rules, applied to both pinyin schemas through a .custom.yaml patch and a redeploy. Native Rime (shared with HarmonyOS): user_dict_export / user_dict_import through librime levers backup/restore, and redeploy. Each closes every session first; controllers start a new one after a session generation bump. rime_levers_api.h is copied from librime 1.17.0, whose install step only ships rime_api.h. Stroke picks and association picks get separate stores (caps 5000 and 10000, trimmed to 90% in one pass), split once from the shared store. The migration bundle keeps one combined "strokeFrequency" map. LitePinyin's backup adapter and stores are removed. The bundle keeps "pinyinLearnedPhrases" (schema 1 requires it), always empty and ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DepengWang
force-pushed
the
feature/ime-pinyin-learning-portability
branch
from
October 19, 2026 15:04
25933f4 to
abb0969
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Android keyboard only (
openless-all/app/android/kotlin/and the sharedmobile-ime/Rime wrapper); no Rust core, desktop or frontend changes, and the migration bundle format is unchanged.1. Keyboard data export / import
Under "个人偏好数据", two actions write and read one JSON file (
openlessKeyboardDataVersion: 1). A checklist picks the parts:pinyin_simpsnapshot (.userdb.txttext)restore_user_dictmerge does the same for the pinyin dictionary.pinyin_simp/userdb. One invalid item rejects the file.OpenLessMigrationState.settings. A changed fuzzy-pinyin set triggers a redeploy..ombbundle or encrypted sync; app settings keep travelling through those.2. Fuzzy pinyin
Seven switches under "拼音云候选": z c s = zh ch sh, n = l, f = h, r = l, an = ang (covers ian/uan), en = eng, in = ing. They are rime-ice's own commented-out rules, appended to
speller/algebrathroughopenless_pinyin_{learning,private}.custom.yamlin the user data dir. Both schemas get the same patch because they share one compiled spelling index. Toggles made while a redeploy runs are folded into the next one.Native Rime (
mobile-ime/rime_engine.cpp, shared with HarmonyOS)user_dict_export/user_dict_import: librime leversbackup_user_dict/restore_user_dictonpinyin_simp.redeploy: removes the compiled pinyin schemas frombuild/(so a same-second rewrite isn't seen as up to date) and deploys both again.OpenLessRime.sessionGenerationis bumped, andRimePinyinControllerstarts a new session when its generation is stale instead of failing with "session is stale".installation_updaterun at initialization: on a fresh profile the first run only writesinstallation.yamland leaves Rime's sync dir as the relative"sync"(the read-only process cwd on Android), so a backup failed until the next process start. Export also refuses a non-absolute sync dir with a clear error. Found by CI's fresh emulator.rime_require_module_levers()keeps the statically linked levers module from being dropped by the linker.rime_levers_api.his copied unchanged from librime 1.17.0, because its install step only shipsrime_api.h.3. Separate learning stores
StrokeUserFrequencyused to hold stroke-code picks and association picks in one store with a 3000 cap, so heavy use of one evicted the other. Now:openless_stroke_frequencykeeps stroke picks (cap 5000), and the newopenless_association_frequencykeeps association picks (cap 10000).hspnz*), inside the migration fence.FrequencyStampCache, so query cost doesn't depend on store size.strokeFrequencymap (15,000 at most, within the 20,000 limit). On import it is split by key.4. LitePinyin leftovers removed
LegacyPinyinBackup, its settings row and its legacy-JSON import category are gone. Its two SharedPreferences stores are deleted on first Rime initialization. Bundle schema 1 requirespinyinLearnedPhrases, so it is kept, always written empty and ignored on import. That keeps bundles readable by both older and newer apps without a schema change.local-bundle-contract.test.mjs,ImeLearningMigrationTestandOpenLessMigrationBundleInstrumentedTestare updated to match.Testing
:app:compileArm64DebugKotlin,:app:testArm64DebugUnitTest: 123 pass, including 10 new inRimePinyinDataTest(fuzzy patch, snapshot validation, key classification, entry validation and merging, trim target, setting ranges, webhook URLs, default checklist).:app:compileArm64DebugAndroidTestKotlin.node --test --test-concurrency=1 scripts/*.test.mjs: 92 pass.RimeEngineIntegrationTest, not run locally (CI emulator):userDictionaryExportsAndMergesSnapshots,fuzzyPinyinPatchIsDeployedAndRemoved,controllerStartsANewSessionAfterSessionsWereClosed.rime_engine.cppchanges.Worth a look
🤖 Generated with Claude Code