$dialer.setAsrProperty
The method specifies an additional setting for the ASR provider. The setting applies only to the current session.
Use $dialer.setAsrProperty
to specify the settings that are not supported by the $dialer.setAsrConfig
method.
The method supports a limited number of settings for the following ASR providers:
- 3iTech
- Tinkoff VoiceKit
- Yandex SpeechKit v2
- Yandex SpeechKit v3
For example, with this method you can:
- Enable sentiment analysis in Tinkoff Voicekit.
- Specify what languages should be recognized by Yandex SpeechKit v3.
Some settings add extra user request data to $request.rawRequest
. In the Speech recognition results article, you can view the full list of supported fields.
Syntax
$dialer.setAsrProperty({
key: "streaming_config.config.enable_sentiment_analysis",
value: true
});
Here:
key
is the setting name.value
is the setting value.
- If you specify a setting that is not supported by the provider, it will be ignored.
- If you specify a value that is not supported for the setting, an error will occur in the script and the call will end.
How to use
Suppose you are using Tinkoff ASR and developing a script that should behave differently based on the user’s gender and emotions:
-
In the initial state of the script, specify the
true
value for these additional settings:streaming_config.config.enable_sentiment_analysis
streaming_config.config.enable_gender_identification
-
In another state, use the received data about the user’s gender and emotions. The data is available in
$request.rawRequest.data.propertiesResponse
.
state: Start
q!: $regex</start>
a: Let’s start.
script:
$dialer.setAsrProperty({
key: "streaming_config.config.enable_sentiment_analysis",
value: true
});
$dialer.setAsrProperty({
key: "streaming_config.config.enable_gender_identification",
value: true
});
state: Hello
intent!: /hello
script: $session.asrResults = $request.rawRequest.data.propertiesResponse.result;
if: $session.asrResults.recognition_result.gender_identification_result.male_proba > 0.8
# Bot answers if the user is likely to be a male
a: ...
if: $session.asrResults.recognition_result.sentiment_analysis_result.negative_prob_audio < 0.2
# Bot answers if the user is unlikely to have negative emotions
a: ...
To get the ASR provider name in the current call, use the $dialer.getAsrProvider
method.
Supported settings
$dialer.setAsrProperty
allows you to specify a limited number of settings for ASR providers:
- Yandex SpeechKit v2
- Yandex SpeechKit v3
- Tinkoff VoiceKit
- 3iTech
config.specification.profanityFilter
config.specification.rawResults
In the Yandex SpeechKit v2 documentation, you can view the description of these settings and learn about their effect on speech recognition.
session_options.recognition_model.text_normalization.text_normalization
session_options.recognition_model.text_normalization.profanity_filter
session_options.recognition_model.text_normalization.literature_text
session_options.recognition_model.text_normalization.phone_formatting_mode
session_options.recognition_model.language_restriction.restriction_type
session_options.recognition_model.language_restriction.language_code
session_options.recognition_classifier.classifiers
In the Yandex SpeechKit v3 documentation, you can view the description of these settings and learn about their effect on speech recognition.
streaming_config.config.profanity_filter
streaming_config.config.speech_contexts.phrases.text
streaming_config.config.speech_contexts.phrases.score
streaming_config.config.speech_contexts.speech_context_dictionary_id
streaming_config.config.enable_automatic_punctuation
streaming_config.config.vad_config.silence_max
streaming_config.config.vad_config.silence_min
streaming_config.config.enable_denormalization
streaming_config.config.enable_sentiment_analysis
streaming_config.config.enable_gender_identification
In the Tinkoff VoiceKit documentation, you can view the description of these settings and learn about their effect on speech recognition.
enable_answerphone_detection
enable_sentiments_detection
enable_age_identification
silence_detection_config.silence_threshold_ms
models
enable_transliteration
In the 3iTech documentation, you can view the description of these settings and learn about their effect on speech recognition.
If you want to use settings that are not supported by $dialer.setAsrProperty
, please contact our support team: support@just-ai.com.
List of specified settings
The list of specified settings and their values is added to $request.rawRequest
. The data is available in the $request.rawRequest.asrTtsProviderData.asr.asrProperties
field.
Example:
{
"streaming_config.config.profanity_filter": "true",
"streaming_config.config.enable_sentiment_analysis": "true",
"streaming_config.config.enable_gender_identification": "true"
}