$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:
- Yandex SpeechKit v2
- Yandex SpeechKit v3
- Tinkoff VoiceKit
- 3iTech
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:
keyis the setting name.valueis 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
truevalue for these additional settings:streaming_config.config.enable_sentiment_analysisstreaming_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.result.
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.profanityFilterconfig.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_normalizationsession_options.recognition_model.text_normalization.profanity_filtersession_options.recognition_model.text_normalization.literature_textsession_options.recognition_model.text_normalization.phone_formatting_modesession_options.recognition_model.language_restriction.restriction_typesession_options.recognition_model.language_restriction.language_code
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_filterstreaming_config.config.speech_contexts.phrases.textstreaming_config.config.speech_contexts.phrases.scorestreaming_config.config.speech_contexts.speech_context_dictionary_idstreaming_config.config.enable_automatic_punctuationstreaming_config.config.vad_config.silence_maxstreaming_config.config.vad_config.silence_minstreaming_config.config.enable_denormalizationstreaming_config.config.enable_sentiment_analysisstreaming_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_detectionenable_sentiments_detectionenable_age_identificationsilence_detection_config.silence_threshold_msmodelsenable_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"
}