Commit graph

9 commits

Author SHA1 Message Date
23439a52f7 Parse Plover number strokes: digits = number bar + positional key
parse_stroke silently dropped digit characters, so number strokes
collapsed onto their letter-only bitmasks: "12K" and "K" both parsed
to K → first-wins dedup let "12K"→"12:00" clobber "K"→"can" (and 297
more core entries: -R→are eaten by 12-R→XII, -S→{^s} by 2-S→2s...).
Digits now map per Plover: 1=S- 2=T- 3=P- 4=H- 5=A- 0=O- 6=-F 7=-P
8=-L 9=-T, all implying #. Collisions: 298 → 0; 300 union keys and
161 translations recovered. Verified: all 262,309 entries byte-exact,
42,000-vector host round trip 0 mismatches.
2026-07-03 20:08:45 +08:00
1d5bef3129 Revert to v2 format, fix CHD with more displacement tries
Spare slots (1.23x) doubled binary size → reverted to v2 (no spare
slots, entry_count == slot_count). CHD now uses entry_count/4
buckets and 1M displacement tries instead of 65K. No trimming.
2026-07-02 15:47:23 +08:00
ab0e90b84b Fix: restore string table + prefix build removed with trim loop 2026-07-02 15:42:23 +08:00
28e0c1a49f Never trim dictionary — hard error if over budget
Removed all trimming/auto-trim logic. Build fails if compiled dict
exceeds flash budget. CHD now uses spare slots (1.23x load factor)
and fewer buckets (entry_count/5) for reliable construction at any
entry count. Binary format bumped to v3: header stores slot_count
and entry_count separately.
2026-07-02 15:39:52 +08:00
1339ec4525 Fix partition + CHD: empirical bytes/entry, 1:1 bucket ratio
Partition: ratio-based split overloaded right side (113K entries →
875KB estimate → heavy trimming to 58K). Now uses 4.5 bytes/entry
from benchmark data → ~34K left, ~113K right, both fit budgets.

CHD: 1:1 bucket ratio (entry_count buckets) prevents hash collision
failures on large partitions. Most buckets have 1 key → trivial
placement. Displacement array grows but still small.
2026-07-02 15:29:25 +08:00
99bf19180e Fix CHD MPHF: increase bucket ratio for large partitions
bucket_count = entry_count/3 caused CHD construction failure on
~113K entry right partition (bucket too crowded → displacement
search exhausted 65536 tries). entry_count/2 gives more buckets,
trades ~19KB displacement overhead for reliable construction.
2026-07-02 15:23:25 +08:00
0908dc7c85 Right-heavy dict partition: 150KB left, 500KB right
Central has more code overhead (behavior, formatter, output, undo,
BLE client) → smaller dict budget. Peripheral is lean → gets bulk
of dict. Ratio-based partition replaces fixed bytes-per-entry estimate.

Full 147K Plover dict, zero trimming target.
2026-07-02 14:30:12 +08:00
20218fa2ab True split-dict: partition dictionary across both halves
Importance-based partitioning — highest-importance entries on left
(central) for zero-latency local lookup, remainder on right
(peripheral) queried over BLE on miss. Both halves embed their own
MPHF binary. Configurable block size for tighter compression.
2026-07-02 14:27:37 +08:00
1ec204b845 Scaffolding: ZMK module structure, Kconfig, DTS, behavior driver
- zephyr/module.yml with dts_root for dt-bindings
- Kconfig: STENO_ENGINE, dict selection (Plover/Lapwing/test),
  MPHF toggle, Unicode modes, history size, multi-stroke timeout
- DTS behavior binding (one_param, steno key index)
- behavior_steno.c: chord accumulation, all-up detection,
  multi-stroke buffering with timeout, star undo, formatter pipeline,
  3-way dict dispatch (split/MPHF/simple trie)
- dict_embed.S: .incbin from generated header path
- steno_keys.h: 23-key layout, bit positions matching compiler
2026-07-02 02:04:28 +08:00