Configuring Speech to Text

Configuring Automatic Language Detection

You can configure the system to handle up to 10 languages using the function #setSttOptions. For example:

#setSttOptions(options: { autoDetectLanguages: ["en-US", "de-DE"] });

Handling Language Change

To handle language changes dynamically, use the following code:

context { input language: string = "en-US"; input autoDetectLanguages: string[] = ["en-US", "de-DE"]; prompt = `Your prompt... # Language instruction Reply in {{language}}`; } when opened do { #changeLanguage($language, #getCurrentSpeaker().speaker); #setSttOptions(options: { autoDetectLanguages: $autoDetectLanguages }); } when languageDetected do { var lang = #getDetectedLanguage()?.language; if (lang is not null) { #log("Detected language: " + lang); #changeLanguage(lang, #getCurrentSpeaker().speaker); set $language = lang; } }

Text Normalization Control

Inverse Text Normalization (ITN) is the process of converting spoken words into their written form. For example, converting the spoken word "four" to the written form "4".

Punctuation

Spoken TextPunctuationRecognized Text
how are youtrue (default)How are you?
how are youfalsehow are you
we can go to the mall park or beachtrue (default)We can go to the mall, park, or beach.
we can go to the mall park or beachfalsewe can go to the mall park or beach

Normalization

Spoken TextNormalizationRecognized Text
support at dasha dot aitrue (default)support@dasha.ai
support at dasha dot aifalsesupport at dasha dot ai
that will cost nine hundred dollarstrue (default)That will cost $900.
that will cost nine hundred dollarsfalsethat will cost nine hundred dollars

Example:

when opened do { #setSttOptions(options: { normalization: false }); }

Functions

setSttOptions

Configures Speech to Text settings.

Parameters

NameTypeDescription
contextstringSpeech to text context. Deprecated.
optionsSttOptionsAdditional configuration

SttOptions (type)

NameTypeDescription
autoDetectLanguagesstring[]List of language codes, such as ["en-US", "de-DE"], for automatic detection. Up to 10 codes.
punctuationboolean?Controls automatic punctuation.
normalizationboolean?Controls Inverse Text Normalization. If disabled, text will be as pronounced (e.g., "four" instead of "4").
Found a mistake? Let us know.

Enroll in beta

Request invite to our private Beta program for developers to join the waitlist. No spam, we promise.