Skip to content

Add custom dictionary support#42

Draft
human37 wants to merge 9 commits intomainfrom
ammon/custom-dictionary
Draft

Add custom dictionary support#42
human37 wants to merge 9 commits intomainfrom
ammon/custom-dictionary

Conversation

@human37
Copy link
Copy Markdown
Owner

@human37 human37 commented Mar 31, 2026

Summary

Closes #34

Adds custom dictionary support so users can correct words/phrases Whisper consistently mishears. Two-layer approach:

  • Layer 1 (prompt hint): Vocabulary words are passed to whisper-cli via --prompt to bias the decoder toward recognizing them
  • Layer 2 (post-processing): Greedy sliding-window exact-match replacement on the transcript output, supporting both single-word and multi-word phrases

Users can manage dictionary entries via a new "Custom Dictionary..." settings window (NSTableView with editable columns), or by editing config.json directly:

{
  "customDictionary": [
    { "from": "nural", "to": "neural" },
    { "from": "chat gee pee tee", "to": "ChatGPT" }
  ]
}

Files changed

  • Config.swift - Added DictionaryEntry struct and customDictionary field
  • DictionaryPostProcessor.swift - Prompt building + sliding window replacement (new)
  • Transcriber.swift - --prompt injection
  • AppDelegate.swift - Wired into transcription pipeline
  • DictionaryWindowController.swift - Settings window with NSTableView (new)
  • StatusBarController.swift - Menu item + config reload integration

Test coverage

  • 16 unit tests for DictionaryPostProcessor (single word, multi-word, punctuation, greedy matching, edge cases)
  • 3 config decoding tests

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.

Is there any plan for dictionary support

1 participant