Doc AWS SDK 예제 GitHub 리포지토리에서 더 많은 SDK 예제를 사용할 수 있습니다. AWS
기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
를 사용한 Amazon Polly 예제 AWS CLI
다음 코드 예제에서는 AWS Command Line Interface Amazon Polly에서를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.
작업은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 관련 시나리오의 컨텍스트에 따라 표시되며, 개별 서비스 함수를 직접적으로 호출하는 방법을 보여줍니다.
각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.
주제
작업
다음 코드 예시에서는 delete-lexicon
의 사용 방법을 보여줍니다.
- AWS CLI
-
어휘 삭제
다음
delete-lexicon
예시에서는 지정된 어휘를 삭제합니다.aws polly delete-lexicon \ --name
w3c
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon Polly 개발자 안내서의 DeleteLexicon 작업 사용을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteLexicon
을 참조하세요.
-
다음 코드 예시에서는 get-lexicon
의 사용 방법을 보여줍니다.
- 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
을 참조하세요.
-
다음 코드 예시에서는 get-speech-synthesis-task
의 사용 방법을 보여줍니다.
- AWS CLI
-
음성 합성 작업 정보 가져오기
다음
get-speech-synthesis-task
예시에서는 지정된 음성 합성 태스크에 대한 정보를 검색합니다.aws polly get-speech-synthesis-task \ --task-id
70b61c0f-57ce-4715-a247-cae8729dcce9
출력:
{ "SynthesisTask": { "TaskId": "70b61c0f-57ce-4715-a247-cae8729dcce9", "TaskStatus": "completed", "OutputUri": "https://s3.us-west-2.amazonaws.com/amzn-s3-demo-bucket/70b61c0f-57ce-4715-a247-cae8729dcce9.mp3", "CreationTime": 1603911042.689, "RequestCharacters": 1311, "OutputFormat": "mp3", "TextType": "text", "VoiceId": "Joanna" } }
자세한 내용은 Amazon Polly 개발자 안내서의 긴 오디오 파일 생성을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetSpeechSynthesisTask
를 참조하세요.
-
다음 코드 예시에서는 list-lexicons
의 사용 방법을 보여줍니다.
- AWS CLI
-
어휘 나열
다음
list-lexicons
예시에서는 발음 어휘를 나열합니다.aws polly list-lexicons
출력:
{ "Lexicons": [ { "Name": "w3c", "Attributes": { "Alphabet": "ipa", "LanguageCode": "en-US", "LastModified": 1603908910.99, "LexiconArn": "arn:aws:polly:us-east-2:123456789012:lexicon/w3c", "LexemesCount": 1, "Size": 492 } } ] }
자세한 내용은 Amazon Polly 개발자 안내서의 ListLexicons 작업 사용을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListLexicons
를 참조하세요.
-
다음 코드 예시에서는 list-speech-synthesis-tasks
의 사용 방법을 보여줍니다.
- AWS CLI
-
음성 합성 작업 나열
다음
list-speech-synthesis-tasks
예시에서는 음성 합성 작업을 나열합니다.aws polly list-speech-synthesis-tasks
출력:
{ "SynthesisTasks": [ { "TaskId": "70b61c0f-57ce-4715-a247-cae8729dcce9", "TaskStatus": "completed", "OutputUri": "https://s3.us-west-2.amazonaws.com/amzn-s3-demo-bucket/70b61c0f-57ce-4715-a247-cae8729dcce9.mp3", "CreationTime": 1603911042.689, "RequestCharacters": 1311, "OutputFormat": "mp3", "TextType": "text", "VoiceId": "Joanna" } ] }
자세한 내용은 Amazon Polly 개발자 안내서의 긴 오디오 파일 생성을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListComplianceSummaries
를 참조하세요.
-
다음 코드 예시에서는 put-lexicon
의 사용 방법을 보여줍니다.
- AWS CLI
-
어휘 저장
다음
put-lexicon
예시에서는 지정된 발음 어휘를 저장합니다.example.pls
파일은 W3C PLS 호환 어휘를 지정합니다.aws polly put-lexicon \ --name
w3c
\ --contentfile://example.pls
example.pls
의 콘텐츠{ <?xml version="1.0" encoding="UTF-8"?> <lexicon version="1.0" xmlns="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2005/01/pronunciation-lexicon http://www.w3.org/TR/2007/CR-pronunciation-lexicon-20071212/pls.xsd" alphabet="ipa" xml:lang="en-US"> <lexeme> <grapheme>W3C</grapheme> <alias>World Wide Web Consortium</alias> </lexeme> </lexicon> }
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon Polly 개발자 안내서의 PutLexicon 작업 사용을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 PutLexicon
을 참조하세요.
-
다음 코드 예시에서는 start-speech-synthesis-task
의 사용 방법을 보여줍니다.
- AWS CLI
-
텍스트 합성
다음
start-speech-synthesis-task
예시에서는text_file.txt
의 텍스트를 합성하고 결과 MP3 파일을 지정된 버킷에 저장합니다.aws polly start-speech-synthesis-task \ --output-format
mp3
\ --output-s3-bucket-nameamzn-s3-demo-bucket
\ --textfile://text_file.txt
\ --voice-idJoanna
출력:
{ "SynthesisTask": { "TaskId": "70b61c0f-57ce-4715-a247-cae8729dcce9", "TaskStatus": "scheduled", "OutputUri": "https://s3.us-east-2.amazonaws.com/amzn-s3-demo-bucket/70b61c0f-57ce-4715-a247-cae8729dcce9.mp3", "CreationTime": 1603911042.689, "RequestCharacters": 1311, "OutputFormat": "mp3", "TextType": "text", "VoiceId": "Joanna" } }
자세한 내용은 Amazon Polly 개발자 안내서의 긴 오디오 파일 생성을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 StartSpeechSynthesisTask
를 참조하세요.
-