翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
DeleteLexicon
次の Java コードサンプルは、Java ベースのアプリケーションを使用して、 AWS リージョンに保存されている特定のレキシコンを削除する方法を示しています。削除されたレキシコンは、音声合成には使用できません。また、GetLexicon
または ListLexicon
API を使用して取得することもできません。
このオペレーションの詳細については、DeleteLexicon
API リファレンスを参照してください。
/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package com.example.polly; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.polly.PollyClient; import software.amazon.awssdk.services.polly.model.DeleteLexiconRequest; import software.amazon.awssdk.services.polly.model.DeleteLexiconResponse; import software.amazon.awssdk.services.polly.model.PollyException ; /** * Before running this Java V2 code example, set up your development environment, including your credentials. * * For more information, see the following documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class DeleteLexiconSample { public static void main(String args[]) { PollyClient polly = PollyClient.builder() .region(Region.US_WEST_2) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); deleteLexicon(polly) ; polly.close(); } private static String LEXICON_NAME = "SampleLexicon"; public static void deleteLexicon(PollyClient client) { try { DeleteLexiconRequest deleteLexiconRequest = DeleteLexiconRequest.builder() .name(LEXICON_NAME).build(); DeleteLexiconResponse deleteLexiconResult = client.deleteLexicon(deleteLexiconRequest); } catch (PollyException e) { System.err.println("Exception caught: " + e); System.exit(1); } } }
package com.amazonaws.polly.samples; import com.amazonaws.services.polly.AmazonPolly; import com.amazonaws.services.polly.AmazonPollyClientBuilder; import com.amazonaws.services.polly.model.DeleteLexiconRequest; public class DeleteLexiconSample { private String LEXICON_NAME = "SampleLexicon"; AmazonPolly client = AmazonPollyClientBuilder.defaultClient(); public void deleteLexicon() { DeleteLexiconRequest deleteLexiconRequest = new DeleteLexiconRequest().withName(LEXICON_NAME); try { client.deleteLexicon(deleteLexiconRequest); } catch (Exception e) { System.err.println("Exception caught: " + e); } } }