Reducing Jargon Errors with Prompts, Vocabulary Hints, and Post-Processing
Practical techniques to help whisper.cpp correctly recognize domain-specific terms, acronyms, and product names.
- accents
- jargon
- guide
Three layers of defense
Layer 1 — Initial prompt
whisper.cpp accepts a short text --prompt that acts as prior context for the decoder, nudging it toward expected words without any retraining:
./whisper-cli -m models/ggml-base.en.bin -f standup.wav \
--prompt "kubectl, Kubernetes, gRPC, staging cluster, CI/CD pipeline, whisper.cpp"Keep the prompt short and relevant — a few dozen domain terms works better than a huge dumped glossary, since the model treats it as recent conversational context, not a lookup table.
Layer 2 — Choose a bigger or multilingual model for heavy accents
# small/base models struggle more with strong accents; step up if budget allows
./whisper-cli -m models/ggml-medium.bin -f interview.wav --language auto--language auto lets whisper.cpp detect the spoken language/accent context rather than forcing an English-only model that penalizes non-native pronunciation patterns.
Layer 3 — Post-processing dictionary correction
For a fixed, known vocabulary (your own product names, internal tool names), a simple find-and-replace pass on common mis-transcriptions is often more reliable than trying to fix everything via prompting:
CORRECTIONS = {
"cube cuddle": "kubectl",
"gee sports": "gRPC",
"whisper c p p": "whisper.cpp",
}
def apply_corrections(text: str) -> str:
for wrong, right in CORRECTIONS.items():
text = text.replace(wrong, right)
return text
try:
with open("raw_transcript.txt") as f:
raw = f.read()
except FileNotFoundError as err:
print(f"Error: transcript file missing: {err}")
raise SystemExit(1)
with open("corrected_transcript.txt", "w") as f:
f.write(apply_corrections(raw))Build this dictionary from real observed mistakes — run a batch of your actual recordings, diff hypothesis against ground truth, and add every recurring miss.
Error handling for the whole flow
if [ -z "${1:-}" ]; then
echo "Usage: $0 <audio-file>" >&2
exit 1
fi
./whisper-cli -m models/ggml-medium.bin -f "$1" --language auto \
--prompt "$(cat prompts/domain-vocab.txt)" \
-otxt --output-file raw_transcript \
|| { echo "Error: transcription failed for $1" >&2; exit 1; }Up next
The final article looks at multilingual and code-switched speech — speakers who mix languages or accents mid-sentence — and how whisper.cpp's language detection copes with it.