Managing lexicons on the Amazon Polly console - Amazon Polly

Managing lexicons on the Amazon Polly console

You can use the Amazon Polly console to upload, download, apply, filter, and delete lexicons. The following procedures demonstrate each of these processes.

Uploading lexicons on the console

To use a pronunciation lexicon, you must first upload it. There are two locations on the console from which you can upload a lexicon, the Text-to-Speech tab and the Lexicons tab.

The following processes describe how to add lexicons that you can use to customize how words and phrases uncommon to the chosen language are pronounced.

To add a lexicon from the Lexicons tab
  1. Sign in to the AWS Management Console and open the Amazon Polly console at https://console.aws.amazon.com/polly/.

  2. Choose the Lexicons tab.

  3. Choose Upload lexicon.

  4. Provide a name for the lexicon and then use Choose a lexicon file to find the lexicon to upload. You can only upload PLS files with .pls or .xml extensions.

  5. Choose Upload lexicon. If a lexicon by the same name (whether a .pls or .xml file) already exists, uploading the lexicon overwrites the existing lexicon.

To add a lexicon from the text-to-Speech tab
  1. Sign in to the AWS Management Console and open the Amazon Polly console at https://console.aws.amazon.com/polly/.

  2. Choose the Text-to-Speech tab.

  3. Expand Additional settings, turn on Customize pronunciation, and then choose Upload lexicon.

  4. Provide a name for the lexicon and then use Choose a lexicon file to find the lexicon to upload. You can only use PLS files with .pls or .xml extensions.

  5. Choose Upload lexicon. If a lexicon with the same name (whether a .pls or .xml file) already exists, uploading the lexicon overwrites the existing lexicon.

Applying lexicons on the console (Synthesize Speech)

The following procedure demonstrates how to apply a lexicon to your input text by applying the W3c.pls lexicon to substitute "World Wide Web Consortium" for "W3C". If you apply multiple lexicons to your text they are applied in a top-down order with the first match taking precedence over later matches. A lexicon is applied to the text only if the language specified in the lexicon is the same as the language chosen.

You can apply a lexicon to plain text or SSML input.

Example – Applying the W3C.pls Lexicon

To create the lexicon you'll need for this exercise, see Using the PutLexicon Operation. Use a plain text editor to create the W3C.pls lexicon shown at the top of the topic. Remember where you save this file.

To apply the W3C.pls lexicon to your input

In this example we introduce a lexicon to substitute "World Wide Web Consortium" for "W3C". Compare the results of this exercise with that of Using SSML on the console for both US English and another language.

  1. Sign in to the AWS Management Console and open the Amazon Polly console at https://console.aws.amazon.com/polly/.

  2. Do one of the following:

    • Turn off SSML and then type or paste this text into the text input box.

      He was caught up in the game. In the middle of the 10/3/2014 W3C meeting he shouted, "Score!" quite loudly.
    • Turn on SSML and then type or paste this text into the text input box.

      <speak>He wasn't paying attention.<break time="1s"/> In the middle of the 10/3/2014 W3C meeting he shouted, "Score!" quite loudly.</speak>
  3. From the Language list, choose English, US, then choose the voice you want to use for this text.

  4. Expand Additional settings and turn on Customize pronunciation.

  5. From the list of lexicons, choose W3C (English, US).

    If the W3C (English, US) lexicon is not listed, choose Upload lexicon and upload it, then choose it from the list. To create this lexicon, see Using the PutLexicon Operation.

  6. To listen to the speech immediately, choose Listen.

  7. To save the speech to a file,

    1. Choose Download.

    2. To change to a different file format, turn on Speech file format settings, choose the file format you want, and then choose Download.

Repeat the previous steps, but choose a different language and notice the difference in the output.

Filtering the lexicon list on the console

The following procedure describes how to filter the lexicons list so that only lexicons of a chosen language are displayed.

To filter the lexicons listed by language
  1. Sign in to the AWS Management Console and open the Amazon Polly console at https://console.aws.amazon.com/polly/.

  2. Choose the Lexicons tab.

  3. Choose Any language.

  4. From the list of languages, choose the language you want to filter on.

    The list displays only the lexicons for the chosen language.

Downloading lexicons on the console

The following process describes how to download one or more lexicons. You can add, remove, or modify lexicon entries in the file and then upload it again to keep your lexicon up-to-date.

To download one or more lexicons
  1. Sign in to the AWS Management Console and open the Amazon Polly console at https://console.aws.amazon.com/polly/.

  2. Choose the Lexicons tab.

  3. Choose the lexicon or lexicons you want to download.

    1. To download a single lexicon, choose its name from the list.

    2. To download multiple lexicons as a single compressed archive file, select the check box next to each entry in the list that you want to download.

  4. Choose Download.

  5. Open the folder where you want to download the lexicon.

  6. Choose Save.

Deleting a lexicon on the console

To delete a lexicon

The following process describes how to delete a lexicon. After deleting the lexicon, you must add it back before you can use it again. You can delete one or more lexicons at the same time by selecting the check boxes next to individual lexicons.

  1. Sign in to the AWS Management Console and open the Amazon Polly console at https://console.aws.amazon.com/polly/.

  2. Choose the Lexicons tab.

  3. Choose one or more lexicons that you want to delete from the list.

  4. Choose Delete.

  5. Enter confirmation text and then choose Delete to remove the lexicon from the Region or Cancel to keep it.