Getting a List of Lexicons - AWS SDK for Ruby

Getting a List of Lexicons

This example uses the list_lexicons method to get the list of lexicons in the us-west-2 region.

Choose Copy to save the code locally.

Create the file polly_list_lexicons.rb.

Add the required gem.


Version 2 of the AWS SDK for Ruby didn’t have service-specific gems.

require 'aws-sdk-polly' # In v2: require 'aws-sdk'

Create an Amazon Polly client and call list_lexicons.

polly = resp = polly.list_lexicons

Display the name, alphabet, and language code of each lexicon.

resp.lexicons.each do |l| puts puts ' Alphabet:' + l.attributes.alphabet puts ' Language:' + l.attributes.language puts end

See the complete example on GitHub.