GetLexicon - Amazon Polly
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

GetLexicon

以下 Java 代码示例显示如何使用基于 Java 的应用程序生成存储在 Amazon 区域中的特定发音词典的内容。

有关此操作的更多信息,请参阅 GetLexicon API 参考。

package com.amazonaws.polly.samples; import com.amazonaws.services.polly.AmazonPolly; import com.amazonaws.services.polly.AmazonPollyClientBuilder; import com.amazonaws.services.polly.model.GetLexiconRequest; import com.amazonaws.services.polly.model.GetLexiconResult; public class GetLexiconSample { private String LEXICON_NAME = "SampleLexicon"; AmazonPolly client = AmazonPollyClientBuilder.defaultClient(); public void getLexicon() { GetLexiconRequest getLexiconRequest = new GetLexiconRequest().withName(LEXICON_NAME); try { GetLexiconResult getLexiconResult = client.getLexicon(getLexiconRequest); System.out.println("Lexicon: " + getLexiconResult.getLexicon()); } catch (Exception e) { System.err.println("Exception caught: " + e); } } }