DeepSpeech 0.9+ provides a Hot-word boosting API that allows you to increase or decrease the probability of specific words appearing in the transcription. This feature is available in the Model class across all bindings (C, Python, JS, Java, and .Net).
Core API Methods
AddHotWord(word, boost): Adds a word with a specific boost value.EraseHotWord(word): Removes the boost for a specific word.ClearHotWords(): Clears all currently boosted hot-words.
Usage Constraints and Best Practices
- Phonetic Relevance: Boosting words that do not exist in the scorer (e.g., many proper nouns) or words that share no phonetic prefix with the input audio will not change the transcription.
- No Spaces: Hot-words cannot contain spaces. To boost a phrase, you must add each word in the phrase separately.
- Error Handling: Adding a boost to a word that is already boosted, or attempting to erase a word that was never boosted, will result in an error.
- Optimal Values: While values vary by use case, it is recommended to keep positive boost values below
20.0. Overly high positive values (e.g., 250.0) may cause the word following the boosted word to be split into individual letters.
ds = Model(args.model)
# ...
ds.addHotWord(word, boosting)
# ...
print(ds.stt(audio))