Skip to content

fix(vocabulary): recover complete words from manual corrections - #1157

Open
kevin1sMe wants to merge 1 commit into
Open-Less:betafrom
kevin1sMe:codex/fix-vocabulary-word-boundaries
Open

kevin1sMe wants to merge 1 commit into
Open-Less:betafrom
kevin1sMe:codex/fix-vocabulary-word-boundaries

Conversation

@kevin1sMe

Copy link
Copy Markdown
Contributor

When a dictated 你好,ZIP is corrected to 你好,VIP, vocabulary learning currently suggests ,Z → ,V: the character diff drops the shared IP, then the minimum-length heuristic pulls in the comma. Adding a sentence-ending period instead causes the correction to be rejected. Internal spelling insertions such as codx → codex are also lost because their source diff is empty.

Recover complete ASCII words and technical identifiers after separating bounded character edits. 你好,ZIP → 你好,VIP。 now produces ZIP → VIP; punctuation and short continued typing are filtered independently, and multiple corrections are published separately. Validate length and vocabulary boundaries after expansion, deduplicate overlapping word candidates, and check each recovered source word against the inserted text before queueing it. Use only local processing and retain the existing user-confirmation flow: accepting this suggestion saves VIP without creating a global ZIP → VIP replacement rule.

The alignment is capped at 64 changed characters per side. Internal identifier separators are preserved; typical URLs, paths, emails, numeric-only changes, unsupported accented-word fragments, pure formatting, whole-word deletions and newly appended words are skipped. CJK context expansion remains a conservative heuristic, now restricted to Han characters rather than arbitrary neighboring punctuation.

Validation:

  • Regression coverage for ZIP/VIP with punctuation and whitespace, first/middle/last character changes, internal insertion/deletion, identifiers and version numbers, multiple corrections, phrase limits, CJK fallback and negative cases.
  • Core regression verifies pending suggestions, no persistence before confirmation, saving only the complete replacement after confirmation, no global correction rule, and rejecting a recovered word absent from the insertion.
  • cargo test --locked -p openless-core
  • cargo clippy --locked -p openless-core --all-targets -- -D warnings
  • Rust formatting checks on the changed files and git diff --check.

This change does not alter native focus acquisition, AX notification timing, or macOS insertion anchoring. The recovered-word containment check cannot prove the edit location when the same word appears elsewhere in a document. No live-editor UI test or application installation was performed.

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