Skip to content

feat: add custom dictionary with words and misspelling corrections#5

Open
nicremo wants to merge 3 commits into
giusmarci:mainfrom
nicremo:feat/dictionary-corrections
Open

feat: add custom dictionary with words and misspelling corrections#5
nicremo wants to merge 3 commits into
giusmarci:mainfrom
nicremo:feat/dictionary-corrections

Conversation

@nicremo

@nicremo nicremo commented Apr 13, 2026

Copy link
Copy Markdown

Summary

Adds a custom dictionary system with two features: vocabulary words for better Whisper transcription accuracy, and misspelling correction rules for the LLM rewrite pass. Also fixes a major performance issue with thinking-mode LLMs.

Depends on: #4 (cloud transcription)

Custom Dictionary

  • Words: Spelling hints sent to Whisper via the prompt parameter (max ~224 tokens). Helps Whisper correctly spell domain-specific terms, names, and technical jargon.
  • Misspelling corrections: Auto-replacement rules (e.g., "Antrpic" -> "Anthropic") injected into the LLM system prompt. The LLM applies these corrections during the rewrite pass.
  • Two-column UI with Word/Misspelling toggle
  • Thread-safe file persistence with async lock
  • Whisper prompt auto-truncated at ~800 chars to stay within the 224-token limit

LLM Performance Fix

  • think: false sent to Ollama for models like Qwen 3.5 and DeepSeek: reduces rewrite time from ~14 seconds to ~0.3 seconds
  • Strips <think> tags from output as a safety fallback
  • Stronger same-language enforcement prompt prevents unwanted translation

What changed

  • New file: dictionary.ts (CRUD operations, file persistence, Whisper prompt builder, LLM context builder)
  • Modified: dictation.ts (dictionary/corrections pipeline integration), ollama.ts (think: false, tag stripping), prompts.ts (dictionary context injection), App.tsx (dictionary UI page), ipc.ts (dictionary/correction handlers)
  • No breaking changes: Dictionary is empty by default, app works exactly as before until words are added

Test plan

  • Dictionary page: add words, verify they appear in the list
  • Dictionary page: add misspelling corrections (from -> to), verify display
  • Dictation with dictionary words: Whisper spells added terms correctly
  • Dictation with corrections: LLM applies misspelling rules in output
  • Remove words/corrections: verify they disappear from list and stop being applied
  • Thinking models (qwen3.5, DeepSeek): verify instant rewrite (~0.3s, not ~14s)
  • Enhancement level "No Filter": works without Ollama running
  • Pipeline logging: raw text and final text visible in console

nicremo added 3 commits April 13, 2026 12:24
- Cloud transcription via Groq/OpenAI-compatible APIs (whisper-large-v3)
- Auto/Cloud/Local transcription mode with automatic offline fallback
- API key encrypted via macOS Keychain (Electron safeStorage)
- Default text model changed from gemma4:e4b (9.6GB) to qwen3.5:2b (2.7GB)
- Configurable API base URL (Groq, OpenAI, Lemonfox, any compatible provider)
- Language selector (German default, 11 languages available)
- Stronger same-language prompt to prevent LLM translation
- Built-in microphone preferred over external devices (AirPods fix)
- New TranscriptionCard UI with source selector, API key management
- Setup wizard with cloud/local transcription choice
- Relaxed hotkey validation: Ollama not required when enhancement is off
Dictionary & Corrections:
- Custom vocabulary tab with words and misspelling corrections
- Words sent as Whisper prompt hints for better transcription
- Corrections injected into LLM system prompt for auto-replacement
- Two-column layout: Words (left) + Misspellings (right)
- Async file lock prevents race conditions on concurrent writes
- Whisper prompt truncated at ~800 chars (224 token limit)
- IPC handlers with runtime input validation

LLM Performance:
- Disable thinking mode (think: false) for qwen3.5 models
- Reduces rewrite time from ~14s to ~0.3s
- Strip <think> tags from output as safety fallback

Pipeline logging:
- Log transcription settings, raw text, and final text for debugging
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