put_lexicon

Polly.Client.put_lexicon(**kwargs)

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.

For more information, see Managing Lexicons.

See also: AWS API Documentation

Request Syntax

response = client.put_lexicon(
    Name='string',
    Content='string'
)
Parameters
  • Name (string) --

    [REQUIRED]

    Name of the lexicon. The name must follow the regular express format [0-9A-Za-z]{1,20}. That is, the name is a case-sensitive alphanumeric string up to 20 characters long.

  • Content (string) --

    [REQUIRED]

    Content of the PLS lexicon as string data.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • Polly.Client.exceptions.InvalidLexiconException
  • Polly.Client.exceptions.UnsupportedPlsAlphabetException
  • Polly.Client.exceptions.UnsupportedPlsLanguageException
  • Polly.Client.exceptions.LexiconSizeExceededException
  • Polly.Client.exceptions.MaxLexemeLengthExceededException
  • Polly.Client.exceptions.MaxLexiconsNumberExceededException
  • Polly.Client.exceptions.ServiceFailureException

Examples

Stores a pronunciation lexicon in an AWS Region.

response = client.put_lexicon(
    Content='file://example.pls',
    Name='W3C',
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}