feat(keyboard): rank pinyin by habit and persist user dictionaries

Erase dialect syllables before abbrev so wom prefers 我们, flush librime
on leave, and add a settings action to forget learned Chinese and English order.
This commit is contained in:
Rocky
2026-08-14 21:49:03 +08:00
parent 2c3a3f80f3
commit b13a1e904b
15 changed files with 588 additions and 5 deletions
@@ -370,6 +370,19 @@ final class EnglishTypingTests: XCTestCase {
XCTAssertFalse(PeriodShortcut.shouldArm(afterSpaceFollowing: "hello "))
}
func testLearningStoreClearRemovesBoosts() {
let suiteName = "EnglishLearningStore.clear.\(UUID().uuidString)"
let defaults = UserDefaults(suiteName: suiteName)!
defer { defaults.removePersistentDomain(forName: suiteName) }
let store = EnglishLearningStore(defaults: defaults)
store.recordAcceptance(of: "hello")
XCTAssertGreaterThan(store.boost(for: "hello"), 0)
store.clear()
XCTAssertEqual(store.boost(for: "hello"), 0)
XCTAssertTrue(store.snapshot().isEmpty)
}
@MainActor
private func apply(_ typing: TypingSessionController, _ output: TypingOutput) {
typing.syncAutocapitalization(