AWS 문서 AWS SDK 예제 리포지토리에 더 많은 SDK
기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
AWS SDK 또는 GetLexicon
CLI와 함께 사용
다음 코드 예제는 GetLexicon
의 사용 방법을 보여줍니다.
- .NET
-
- AWS SDK for .NET
-
참고
더 많은 정보가 있습니다. GitHub AWS 코드 예제 리포지토리
에서 전체 예제를 찾고 설정 및 실행하는 방법을 배워보세요. using System; using System.Threading.Tasks; using Amazon.Polly; using Amazon.Polly.Model; /// <summary> /// Retrieves information about a specific Amazon Polly lexicon. /// </summary> public class GetLexicon { public static async Task Main(string[] args) { string lexiconName = "SampleLexicon"; var client = new AmazonPollyClient(); await GetPollyLexiconAsync(client, lexiconName); } public static async Task GetPollyLexiconAsync(AmazonPollyClient client, string lexiconName) { var getLexiconRequest = new GetLexiconRequest() { Name = lexiconName, }; try { var response = await client.GetLexiconAsync(getLexiconRequest); Console.WriteLine($"Lexicon:\n Name: {response.Lexicon.Name}"); Console.WriteLine($"Content: {response.Lexicon.Content}"); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } } }
-
API 세부 정보는 AWS SDK for .NET API GetLexicon참조를 참조하십시오.
-
- CLI
-
- AWS CLI
-
어휘의 콘텐츠를 검색하는 방법
다음
get-lexicon
예시에서는 지정된 발음 어휘의 콘텐츠를 검색합니다.aws polly get-lexicon \ --name w3c
출력:
{ "Lexicon": { "Content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<lexicon version=\"1.0\" \n xmlns= \"http://www.w3.org/2005/01/pronunciation-lexicon\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n xsi:schemaLocation=\"http://www.w3.org/2005/01/pronunciation-lexicon \n http://www.w3.org/TR/2007/CR-pronunciation- lexicon-20071212/pls.xsd\"\n alphabet=\"ipa\" \n xml:lang=\"en-US\">\n <lexeme>\n <grapheme>W3C</grapheme>\n <alias>World Wide Web Consortium</alias>\n </lexeme>\n</lexicon>\n", "Name": "w3c" }, "LexiconAttributes": { "Alphabet": "ipa", "LanguageCode": "en-US", "LastModified": 1603908910.99, "LexiconArn": "arn:aws:polly:us-west-2:880185128111:lexicon/w3c", "LexemesCount": 1, "Size": 492 } }
자세한 내용은 Amazon Polly 개발자 안내서의 GetLexicon 작업 사용을 참조하십시오.
-
API 세부 정보는 AWS CLI 명령 GetLexicon
참조를 참조하십시오.
-
- Python
-
- SDK for Python(Boto3)
-
참고
자세한 내용은 에서 확인할 수 GitHub 있습니다. AWS 코드 예제 리포지토리
에서 전체 예제를 찾고 설정 및 실행하는 방법을 배워보세요. class PollyWrapper: """Encapsulates Amazon Polly functions.""" def __init__(self, polly_client, s3_resource): """ :param polly_client: A Boto3 Amazon Polly client. :param s3_resource: A Boto3 Amazon Simple Storage Service (Amazon S3) resource. """ self.polly_client = polly_client self.s3_resource = s3_resource self.voice_metadata = None def get_lexicon(self, name): """ Gets metadata and contents of an existing lexicon. :param name: The name of the lexicon to retrieve. :return: The retrieved lexicon. """ try: response = self.polly_client.get_lexicon(Name=name) logger.info("Got lexicon %s.", name) except ClientError: logger.exception("Couldn't get lexicon %s.", name) raise else: return response
-
API에 대한 자세한 내용은 파이썬용AWS SDK (Boto3) API 레퍼런스를 참조하십시오 GetLexicon.
-
DescribeVoices
GetSpeechSynthesisTask