ListLexicon - Amazon Polly

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

ListLexicon

Nel seguente esempio di codice Python viene utilizzato AWS SDK for Python (Boto) per elencare i lessici nel tuo account nella regione specificata nella configurazione di AWS locale. Per informazioni sulla creazione del file di configurazione, consulta Fase 2.1: configurazione di AWS CLI.

Per ulteriori informazioni su questa operazione, consulta il riferimento per l'API ListLexicons.

import sys from boto3 import Session from botocore.exceptions import BotoCoreError, ClientError # Create a client using the credentials and region defined in the adminuser # section of the AWS credentials and configuration files session = Session(profile_name="adminuser") polly = session.client("polly") try: # Request the list of available lexicons response = polly.list_lexicons() except (BotoCoreError, ClientError) as error: # The service returned an error, exit gracefully print(error) sys.exit(-1) # Get the list of lexicons in the response lexicons = response.get("Lexicons", []) print("{0} lexicon(s) found".format(len(lexicons))) # Output a formatted list of lexicons with some of the attributes for lexicon in lexicons: print((u" - {Name} ({Attributes[LanguageCode]}), " "{Attributes[LexemesCount]} lexeme(s)").format(**lexicon))