createDictionary method
Creates a custom dictionary for improving transcription accuracy. A dictionary contains custom words and phrases that the ASR engine might not recognize, such as brand names, technical terms, or proper nouns. You can reference a dictionary when configuring a smart subtitles output.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerErrorException.
May throw ServiceQuotaExceededException.
May throw TooManyRequestException.
May throw ValidationException.
Parameter language :
The language of the dictionary entries. Specify the language using an ISO
639-2/T three-letter code. Supported values: eng, fra, ita, deu, spa, por.
Parameter name :
A user-friendly name for this dictionary.
Parameter entries :
The dictionary entries payload. Contains the custom words and phrases for
the dictionary. Maximum size is 40,960 characters.
Parameter tags :
Optional tags to associate with the dictionary.
Implementation
Future<CreateDictionaryResponse> createDictionary({
required DictionaryLanguage language,
required String name,
String? entries,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'language': language.value,
'name': name,
if (entries != null) 'entries': entries,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/v1/dictionary',
exceptionFnMap: _exceptionFns,
);
return CreateDictionaryResponse.fromJson(response);
}