Polly / Client / put_lexicon

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.

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.

See also: AWS API Documentation

Request Syntax

response = client.put_lexicon(
    Name='string',
    Content='string',
    Tags={
        'string': 'string'
    }
)
Parameters:
  • Name (string) –

    [REQUIRED]

    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 (string) –

    [REQUIRED]

    Content of the PLS lexicon as string data.

  • Tags (dict) –

    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.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

Exceptions

Examples

Stores a pronunciation lexicon in an AWS Region.

response = client.put_lexicon(
    Content='<Lexicon Content>',
    Name='W3C',
)

print(response)

Expected Output:

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