:doc:`Polly <../../polly>` / Client / put_lexicon

***********
put_lexicon
***********



.. py:method:: 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 <https://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html>`__.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/polly-2016-06-10/PutLexicon>`_  


  **Request Syntax**
  ::

    response = client.put_lexicon(
        Name='string',
        Content='string'
    )
    
  :type Name: string
  :param Name: **[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.

    

  
  :type Content: string
  :param Content: **[REQUIRED]** 

    Content of the PLS lexicon as string data.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {}
      
    **Response Structure**

    

    - *(dict) --* 
  
  **Exceptions**
  
  *   :py:class:`Polly.Client.exceptions.InvalidLexiconException`

  
  *   :py:class:`Polly.Client.exceptions.UnsupportedPlsAlphabetException`

  
  *   :py:class:`Polly.Client.exceptions.UnsupportedPlsLanguageException`

  
  *   :py:class:`Polly.Client.exceptions.LexiconSizeExceededException`

  
  *   :py:class:`Polly.Client.exceptions.MaxLexemeLengthExceededException`

  
  *   :py:class:`Polly.Client.exceptions.MaxLexiconsNumberExceededException`

  
  *   :py:class:`Polly.Client.exceptions.ServiceFailureException`

  

  **Examples**

  Stores a pronunciation lexicon in an AWS Region.
  ::

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

  
  Expected Output:
  ::

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

  