Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.
Amazon Polly Polly-Beispiele mit SDK für SAP ABAP
Die folgenden Codebeispiele zeigen Ihnen, wie Sie mithilfe des AWS SDK für SAP ABAP mit Amazon Polly Aktionen ausführen und gängige Szenarien implementieren.
Aktionen sind Codeauszüge aus größeren Programmen und müssen im Kontext ausgeführt werden. Während Aktionen Ihnen zeigen, wie Sie einzelne Service-Funktionen aufrufen, können Sie Aktionen im Kontext der zugehörigen Szenarien anzeigen.
Jedes Beispiel enthält einen Link zum vollständigen Quellcode, wo Sie Anweisungen zum Einrichten und Ausführen des Codes im Kodex finden.
Themen
Aktionen
Das folgende Codebeispiel zeigt, wie Sie es verwenden. DeleteLexicon
- SDK für SAP ABAP
-
Anmerkung
Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS -Code-Beispiel-
einrichten und ausführen. TRY. lo_ply->deletelexicon( iv_name ). MESSAGE 'Lexicon deleted successfully.' TYPE 'I'. CATCH /aws1/cx_plylexiconnotfoundex. MESSAGE 'Lexicon not found.' TYPE 'E'. CATCH /aws1/cx_plyservicefailureex. MESSAGE 'Service failure occurred.' TYPE 'E'. ENDTRY.-
Einzelheiten zur API finden Sie DeleteLexiconin der API-Referenz zum AWS SDK für SAP ABAP.
-
Das folgende Codebeispiel zeigt die VerwendungDescribeVoices.
- SDK für SAP ABAP
-
Anmerkung
Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS -Code-Beispiel-
einrichten und ausführen. TRY. " Only pass optional parameters if they have values IF iv_engine IS NOT INITIAL AND iv_language IS NOT INITIAL. oo_result = lo_ply->describevoices( iv_engine = iv_engine iv_languagecode = iv_language ). ELSEIF iv_engine IS NOT INITIAL. oo_result = lo_ply->describevoices( iv_engine = iv_engine ). ELSEIF iv_language IS NOT INITIAL. oo_result = lo_ply->describevoices( iv_languagecode = iv_language ). ELSE. oo_result = lo_ply->describevoices( ). ENDIF. MESSAGE 'Retrieved voice metadata.' TYPE 'I'. CATCH /aws1/cx_plyinvalidnexttokenex. MESSAGE 'The NextToken is invalid.' TYPE 'E'. CATCH /aws1/cx_plyservicefailureex. MESSAGE 'Service failure occurred.' TYPE 'E'. ENDTRY.-
Einzelheiten zur API finden Sie DescribeVoicesin der API-Referenz zum AWS SDK für SAP ABAP.
-
Das folgende Codebeispiel zeigt die VerwendungGetLexicon.
- SDK für SAP ABAP
-
Anmerkung
Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS -Code-Beispiel-
einrichten und ausführen. TRY. oo_result = lo_ply->getlexicon( iv_name ). DATA(lo_lexicon) = oo_result->get_lexicon( ). IF lo_lexicon IS BOUND. DATA(lv_lex_name) = lo_lexicon->get_name( ). MESSAGE |Retrieved lexicon: { lv_lex_name }| TYPE 'I'. ENDIF. CATCH /aws1/cx_plylexiconnotfoundex. MESSAGE 'Lexicon not found.' TYPE 'E'. CATCH /aws1/cx_plyservicefailureex. MESSAGE 'Service failure occurred.' TYPE 'E'. ENDTRY.-
Einzelheiten zur API finden Sie GetLexiconin der API-Referenz zum AWS SDK für SAP ABAP.
-
Das folgende Codebeispiel zeigt die VerwendungGetSpeechSynthesisTask.
- SDK für SAP ABAP
-
Anmerkung
Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS -Code-Beispiel-
einrichten und ausführen. TRY. oo_result = lo_ply->getspeechsynthesistask( iv_task_id ). DATA(lo_task) = oo_result->get_synthesistask( ). IF lo_task IS BOUND. DATA(lv_status) = lo_task->get_taskstatus( ). MESSAGE |Task status: { lv_status }| TYPE 'I'. ENDIF. CATCH /aws1/cx_plyinvalidtaskidex. MESSAGE 'Invalid task ID.' TYPE 'E'. CATCH /aws1/cx_plyservicefailureex. MESSAGE 'Service failure occurred.' TYPE 'E'. CATCH /aws1/cx_plysynthesistsknotf00. MESSAGE 'Synthesis task not found.' TYPE 'E'. ENDTRY.-
Einzelheiten zur API finden Sie GetSpeechSynthesisTaskin der API-Referenz zum AWS SDK für SAP ABAP.
-
Das folgende Codebeispiel zeigt die VerwendungListLexicons.
- SDK für SAP ABAP
-
Anmerkung
Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS -Code-Beispiel-
einrichten und ausführen. TRY. oo_result = lo_ply->listlexicons( ). DATA(lt_lexicons) = oo_result->get_lexicons( ). DATA(lv_count) = lines( lt_lexicons ). MESSAGE |Found { lv_count } lexicons| TYPE 'I'. CATCH /aws1/cx_plyinvalidnexttokenex. MESSAGE 'Invalid NextToken.' TYPE 'E'. CATCH /aws1/cx_plyservicefailureex. MESSAGE 'Service failure occurred.' TYPE 'E'. ENDTRY.-
Einzelheiten zur API finden Sie ListLexiconsin der API-Referenz zum AWS SDK für SAP ABAP.
-
Das folgende Codebeispiel zeigt die VerwendungListSpeechSynthesisTasks.
- SDK für SAP ABAP
-
Anmerkung
Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS -Code-Beispiel-
einrichten und ausführen. TRY. " Only pass optional parameters if they have values IF iv_max_results IS NOT INITIAL AND iv_status IS NOT INITIAL. oo_result = lo_ply->listspeechsynthesistasks( iv_maxresults = iv_max_results iv_status = iv_status ). ELSEIF iv_max_results IS NOT INITIAL. oo_result = lo_ply->listspeechsynthesistasks( iv_maxresults = iv_max_results ). ELSEIF iv_status IS NOT INITIAL. oo_result = lo_ply->listspeechsynthesistasks( iv_status = iv_status ). ELSE. oo_result = lo_ply->listspeechsynthesistasks( ). ENDIF. DATA(lt_tasks) = oo_result->get_synthesistasks( ). DATA(lv_count) = lines( lt_tasks ). MESSAGE |Found { lv_count } synthesis tasks| TYPE 'I'. CATCH /aws1/cx_plyinvalidnexttokenex. MESSAGE 'Invalid NextToken.' TYPE 'E'. CATCH /aws1/cx_plyservicefailureex. MESSAGE 'Service failure occurred.' TYPE 'E'. ENDTRY.-
Einzelheiten zur API finden Sie ListSpeechSynthesisTasksin der API-Referenz zum AWS SDK für SAP ABAP.
-
Das folgende Codebeispiel zeigt die VerwendungPutLexicon.
- SDK für SAP ABAP
-
Anmerkung
Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS -Code-Beispiel-
einrichten und ausführen. TRY. lo_ply->putlexicon( iv_name = iv_name iv_content = iv_content ). MESSAGE 'Lexicon created successfully.' TYPE 'I'. CATCH /aws1/cx_plyinvalidlexiconex. MESSAGE 'Invalid lexicon.' TYPE 'E'. CATCH /aws1/cx_plylexiconsizeexcdex. MESSAGE 'Lexicon size exceeded.' TYPE 'E'. CATCH /aws1/cx_plymaxlexemelengthe00. MESSAGE 'Maximum lexeme length exceeded.' TYPE 'E'. CATCH /aws1/cx_plymaxlexiconsnoexc00. MESSAGE 'Maximum number of lexicons exceeded.' TYPE 'E'. CATCH /aws1/cx_plyservicefailureex. MESSAGE 'Service failure occurred.' TYPE 'E'. CATCH /aws1/cx_plyunsuppedplsalpha00. MESSAGE 'Unsupported PLS alphabet.' TYPE 'E'. CATCH /aws1/cx_plyunsuppedplslangu00. MESSAGE 'Unsupported PLS language.' TYPE 'E'. ENDTRY.-
Einzelheiten zur API finden Sie PutLexiconin der API-Referenz zum AWS SDK für SAP ABAP.
-
Das folgende Codebeispiel zeigt die VerwendungStartSpeechSynthesisTask.
- SDK für SAP ABAP
-
Anmerkung
Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS -Code-Beispiel-
einrichten und ausführen. TRY. " Only pass optional parameters if they have values IF iv_lang_code IS NOT INITIAL AND iv_s3_key_prefix IS NOT INITIAL. oo_result = lo_ply->startspeechsynthesistask( iv_engine = iv_engine iv_outputformat = iv_audio_format iv_outputs3bucketname = iv_s3_bucket iv_outputs3keyprefix = iv_s3_key_prefix iv_text = iv_text iv_voiceid = iv_voice_id iv_languagecode = iv_lang_code ). ELSEIF iv_lang_code IS NOT INITIAL. oo_result = lo_ply->startspeechsynthesistask( iv_engine = iv_engine iv_outputformat = iv_audio_format iv_outputs3bucketname = iv_s3_bucket iv_text = iv_text iv_voiceid = iv_voice_id iv_languagecode = iv_lang_code ). ELSEIF iv_s3_key_prefix IS NOT INITIAL. oo_result = lo_ply->startspeechsynthesistask( iv_engine = iv_engine iv_outputformat = iv_audio_format iv_outputs3bucketname = iv_s3_bucket iv_outputs3keyprefix = iv_s3_key_prefix iv_text = iv_text iv_voiceid = iv_voice_id ). ELSE. oo_result = lo_ply->startspeechsynthesistask( iv_engine = iv_engine iv_outputformat = iv_audio_format iv_outputs3bucketname = iv_s3_bucket iv_text = iv_text iv_voiceid = iv_voice_id ). ENDIF. MESSAGE 'Speech synthesis task started.' TYPE 'I'. CATCH /aws1/cx_plyinvalids3bucketex. MESSAGE 'Invalid S3 bucket.' TYPE 'E'. CATCH /aws1/cx_plyinvalidssmlex. MESSAGE 'Invalid SSML.' TYPE 'E'. CATCH /aws1/cx_plylexiconnotfoundex. MESSAGE 'Lexicon not found.' TYPE 'E'. CATCH /aws1/cx_plyservicefailureex. MESSAGE 'Service failure occurred.' TYPE 'E'. CATCH /aws1/cx_plytextlengthexcdex. MESSAGE 'Text length exceeded maximum.' TYPE 'E'. ENDTRY.-
Einzelheiten zur API finden Sie StartSpeechSynthesisTaskin der API-Referenz zum AWS SDK für SAP ABAP.
-
Das folgende Codebeispiel zeigt die VerwendungSynthesizeSpeech.
- SDK für SAP ABAP
-
Anmerkung
Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS -Code-Beispiel-
einrichten und ausführen. TRY. " Only pass optional language code if it has a value IF iv_lang_code IS NOT INITIAL. oo_result = lo_ply->synthesizespeech( iv_engine = iv_engine iv_outputformat = iv_output_fmt iv_text = iv_text iv_voiceid = iv_voice_id iv_languagecode = iv_lang_code ). ELSE. oo_result = lo_ply->synthesizespeech( iv_engine = iv_engine iv_outputformat = iv_output_fmt iv_text = iv_text iv_voiceid = iv_voice_id ). ENDIF. MESSAGE 'Speech synthesized successfully.' TYPE 'I'. CATCH /aws1/cx_plyinvalidssmlex. MESSAGE 'Invalid SSML.' TYPE 'E'. CATCH /aws1/cx_plylexiconnotfoundex. MESSAGE 'Lexicon not found.' TYPE 'E'. CATCH /aws1/cx_plyservicefailureex. MESSAGE 'Service failure occurred.' TYPE 'E'. CATCH /aws1/cx_plytextlengthexcdex. MESSAGE 'Text length exceeded maximum.' TYPE 'E'. ENDTRY.-
Einzelheiten zur API finden Sie SynthesizeSpeechin der API-Referenz zum AWS SDK für SAP ABAP.
-