Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
ListLexicons
Contoh kode Java berikut menunjukkan cara menggunakan aplikasi berbasis Java untuk menghasilkan daftar leksikon pengucapan yang disimpan di Wilayah. AWS
Untuk informasi lebih lanjut tentang operasi ini, lihat referensi untuk ListLexicons
API.
package com.amazonaws.polly.samples; import com.amazonaws.services.polly.AmazonPolly; import com.amazonaws.services.polly.AmazonPollyClientBuilder; import com.amazonaws.services.polly.model.LexiconAttributes; import com.amazonaws.services.polly.model.LexiconDescription; import com.amazonaws.services.polly.model.ListLexiconsRequest; import com.amazonaws.services.polly.model.ListLexiconsResult; public class ListLexiconsSample { AmazonPolly client = AmazonPollyClientBuilder.defaultClient(); public void listLexicons() { ListLexiconsRequest listLexiconsRequest = new ListLexiconsRequest(); try { String nextToken; do { ListLexiconsResult listLexiconsResult = client.listLexicons(listLexiconsRequest); nextToken = listLexiconsResult.getNextToken(); listLexiconsRequest.setNextToken(nextToken); for (LexiconDescription lexiconDescription : listLexiconsResult.getLexicons()) { LexiconAttributes attributes = lexiconDescription.getAttributes(); System.out.println("Name: " + lexiconDescription.getName() + ", Alphabet: " + attributes.getAlphabet() + ", LanguageCode: " + attributes.getLanguageCode() + ", LastModified: " + attributes.getLastModified() + ", LexemesCount: " + attributes.getLexemesCount() + ", LexiconArn: " + attributes.getLexiconArn() + ", Size: " + attributes.getSize()); } } while (nextToken != null); } catch (Exception e) { System.err.println("Exception caught: " + e); } } }