put_lexicon
async
¶
put_lexicon(
name: LexiconName,
content: LexiconContent,
*,
config_overrides: Optional[AsyncPollyClientConfig] = None,
tags: Optional[TagMap] = None,
) -> PutLexiconOutput
Stores a pronunciation lexicon in an Amazon Web Services Region. If a lexicon with the same name already exists in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it might take some time before the lexicon is available to the SynthesizeSpeech operation.
Overwriting a lexicon keeps its existing tags. You can specify tags only when you create a lexicon. If you specify tags for a lexicon that already exists, the request fails with a ValidationException. To change the tags of an existing lexicon, use TagResource and UntagResource.
For more information, see Managing Lexicons.
Parameters:
-
name(LexiconName) –Name of the lexicon. The name must follow the regular expression format [0-9A-Za-z]{1,20}. That is, the name is a case-sensitive alphanumeric string up to 20 characters long.
-
content(LexiconContent) –Content of the PLS lexicon as string data.
-
tags(Optional[TagMap], default:None) –The metadata that you apply to the lexicon to help you categorize and organize it. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters. You can't replace the tags of an existing lexicon by overwriting it with PutLexicon.
Raises:
-
InvalidLexiconException–Amazon Polly can't find the specified lexicon. Verify that the lexicon's name is spelled correctly, and then try again.
-
InvalidTagParameterException–The resource ARN or a tag in the request isn't valid. Specify the ARN of a supported resource in the Amazon Web Services account and Region of the request. Tag keys can have a maximum length of 128 characters, and tag values can have a maximum length of 256 characters. Correct the ARN or the tags, and then try again.
-
LexiconSizeExceededException–The maximum size of the specified lexicon would be exceeded by this operation.
-
MaxLexemeLengthExceededException–The maximum size of the lexeme would be exceeded by this operation.
-
MaxLexiconsNumberExceededException–The maximum number of lexicons would be exceeded by this operation.
-
ServiceFailureException–An unknown condition has caused a service failure.
-
TooManyTagsException–The list of tags on the resource is over the limit. The maximum number of tags that can be applied to a resource is 50. Remove unused tags or reduce the number of tags in the request, and then try again.
-
UnsupportedPlsAlphabetException–The alphabet specified by the lexicon is not a supported alphabet. Valid values are
ipa,x-sampa,x-amazon-pinyin,x-amazon-jyutping,x-amazon-pron-kana, andx-amazon-yomigana. Replace the unsupported alphabet with one of the valid values and resubmit your request. -
UnsupportedPlsLanguageException–The language specified in the lexicon is unsupported. For a list of supported languages, see Lexicon Attributes.
-
ValidationException–The input fails to satisfy the constraints specified by the service.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To save a lexicon Stores a pronunciation lexicon in an AWS Region.