Skip to content

[feature] phrase dictionary learns from post-dictation corrections - #295

Merged
YJack0000 merged 1 commit into
mainfrom
feat/voice-typing-dictionary
Aug 22, 2026
Merged

[feature] phrase dictionary learns from post-dictation corrections#295
YJack0000 merged 1 commit into
mainfrom
feat/voice-typing-dictionary

Conversation

@YJack0000

Copy link
Copy Markdown
Contributor

What this changes

Voice typing gains a phrase dictionary with a learn-from-correction loop: after auto-paste, Parley watches the pasted-into field via the Accessibility API (up to 60 s); when the user fixes a misheard word in place, the overlay bubble offers to add the correction (⌥↩ or click, ignore twice and it stops asking). Dictionary phrases bias recognition at every STT provider (Soniox context.terms, Deepgram keyterm/keywords, AssemblyAI keyterms_prompt/word_boost, OpenAI transcription prompt, Gemini systemInstruction) and known variants are rewritten before display/paste/import. Also: a Dictionary panel in Settings, a correct-and-learn editor in voice-typing history (manual fallback for AX-opaque apps), four new MCP tools (list/add/update/delete_dictionary_phrase), history entries now record the app they were pasted into, and voice typing finally sends real languageHints.

Why

STT keeps mangling proper nouns and voice typing was fire-and-forget — the same word came back wrong in every dictation, with no way to teach the app. A correction made seconds after a paste is a free, high-quality label; catching it needs no keylogging because Accessibility (already granted for the paste itself) can read the focused field. Observation is deliberately narrow: only the field we just pasted into, only for a minute, diff computed locally and discarded.

Closes #294.

How it was verified

  • bunx tsc --noEmit passes
  • bunx vitest run passes (255 tests, incl. 24 new for the correction diff + replacements)
  • Ran the app (debug build) and exercised the change — boot, dictionary.json round-trip via all four MCP tools; cargo test (42) and clippy -D warnings clean
  • Added or updated tests
  • Added new user-facing strings to both zh-TW and en in src/i18n/messages.ts

Not yet exercised end-to-end: the live mic → in-place correction → bubble flow needs a human at the keyboard; the paste-landing race (baseline snapshotted before the target app processes ⌘V) is guarded by a re-baseline check with unit tests.

Known gap: the hosted-batch path carries no vocabulary yet — the cloud endpoint has no field for it (needs a parley-internal change; hosted live relay is unaffected since it forwards the Soniox config frame verbatim).

Screenshots

The suggestion bubble only exists mid-flow (it is the non-activating dictation overlay re-purposed), so no static capture here; the Settings → Dictionary panel follows the existing Evaluations panel layout.

Voice typing pastes and forgets; a word the STT misheard stays wrong in
every future dictation. This adds a phrase dictionary with a
Typeless-style learning loop:

- After auto-paste, watch the pasted-into field via the Accessibility
  API (already granted for the paste itself) for up to 60 s. When the
  user fixes a word in place, diff the settled value against what we
  inserted and offer — in the non-activating overlay bubble — to add
  the correction (Alt+Enter or click; ignore twice and it stops asking).
- dictionary.json (app config dir) is the shared truth: Settings panel,
  the voice-typing/meeting pipelines, and four new MCP tools
  (list/add/update/delete_dictionary_phrase) all read and write it.
- Entries bias recognition at the source — Soniox context.terms,
  Deepgram keyterm/keywords, AssemblyAI keyterms_prompt/word_boost,
  OpenAI transcription prompt, Gemini systemInstruction — and known
  variants are rewritten in normalizeTranscriptText before display,
  paste, or import. Voice typing also finally sends real languageHints.
- History entries record the app they were pasted into, and gain an
  inline correct-and-learn editor as the manual fallback for apps whose
  AX values are unreadable.

Observation is deliberately narrow: only the field we just pasted into,
only for a minute, diff computed locally and discarded. The hosted batch
path carries no vocabulary yet (cloud endpoint has no field for it).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@YJack0000
YJack0000 merged commit 8ec6b55 into main Aug 22, 2026
3 checks passed
@sonarqubecloud

Copy link
Copy Markdown

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.

Voice typing: phrase dictionary that learns from post-dictation corrections

1 participant