Speech to TextFeatures
Text replacement
Text replacement substitutes specific words or patterns in the transcript after transcription is complete.
Availability
Text replacement is available with the Standard and Enhanced models for pre-recorded and streaming transcription, and with Linden 1 for agent STT. See Feature availability.
Replace words and phrases
Add replacements to transcript_filtering_config:
"transcription_config": {
"model": "enhanced",
"language": "en",
"transcript_filtering_config": {
"replacements": [
{"from": "foo", "to": "bar"},
{"from": "heavy", "to": "light"}
]
}
}
Common uses for text replacement:
- Censoring profanities in languages without built-in support
- Masking sensitive information such as card numbers and personal data
- Standardizing terminology or brand names
- Fixing known issues with particular words
Text replacement is case-sensitive and applied after transcription is complete. In the example above, "Foo" would not be replaced by "bar".
To add new vocabulary rather than replace it, use the custom dictionary instead.
Match with a regular expression
You can use regular expressions in ECMAScript format in the from field by adding forward-slash delimiters:
// Replace both "Hello" and "hello" with "goodbye"
{"from": "/^[hH]ello$/", "to": "goodbye"}
// Add brackets around "cheese" while preserving the original word
{"from": "/(cheese)/", "to": "[$1]"}
Replacement rules are applied in this order:
- Plain word replacements are processed first.
- If no match is found, regex replacements are tried in the order listed.
- Once a word matches a replacement, no further replacements are applied to it.
- Regex replacements are global, so all matches are replaced.
- Malformed regex patterns cause the transcription to fail with an error.