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 Text | Punctuation | Recognized Text |
---|---|---|
how are you | true (default) | How are you? |
how are you | false | how are you |
we can go to the mall park or beach | true (default) | We can go to the mall, park, or beach. |
we can go to the mall park or beach | false | we can go to the mall park or beach |
Normalization
Spoken Text | Normalization | Recognized Text |
---|---|---|
support at dasha dot ai | true (default) | support@dasha.ai |
support at dasha dot ai | false | support at dasha dot ai |
that will cost nine hundred dollars | true (default) | That will cost $900. |
that will cost nine hundred dollars | false | that will cost nine hundred dollars |
Example:
when opened do { #setSttOptions(options: { normalization: false }); }
Functions
setSttOptions
Configures Speech to Text settings.
Parameters
Name | Type | Description |
---|---|---|
context | string | Speech to text context. Deprecated. |
options | SttOptions | Additional configuration |
SttOptions (type)
Name | Type | Description |
---|---|---|
autoDetectLanguages | string[] | List of language codes, such as ["en-US", "de-DE"], for automatic detection. Up to 10 codes. |
punctuation | boolean? | Controls automatic punctuation. |
normalization | boolean? | Controls Inverse Text Normalization. If disabled, text will be as pronounced (e.g., "four" instead of "4"). |
Found a mistake? Let us know.