Search in sources :

Example 6 with DeleteCustomModelOptions

use of com.ibm.watson.text_to_speech.v1.model.DeleteCustomModelOptions in project java-sdk by watson-developer-cloud.

the class TextToSpeechIT method testDeleteCustomPrompts.

/**
 * Test deleteCustomPrompts.
 */
@Test
public void testDeleteCustomPrompts() {
    try {
        CreateCustomModelOptions createCustomModelOptions = new CreateCustomModelOptions.Builder().description("testdescription").name("testname").language(CreateCustomModelOptions.Language.EN_US).build();
        CustomModel customModel = service.createCustomModel(createCustomModelOptions).execute().getResult();
        customizationId = customModel.getCustomizationId();
        PromptMetadata promptMetadata = new PromptMetadata.Builder().promptText("promptText").build();
        File file = new File(RESOURCE + "numbers.wav");
        AddCustomPromptOptions addCustomPromptOptions = new AddCustomPromptOptions.Builder().customizationId(customizationId).promptId("testId").metadata(promptMetadata).file(file).build();
        Prompt prompt = service.addCustomPrompt(addCustomPromptOptions).execute().getResult();
        assertNotNull(prompt.getStatus());
        DeleteCustomPromptOptions deleteCustomPromptOptions = new DeleteCustomPromptOptions.Builder().customizationId(customizationId).promptId(prompt.getPromptId()).build();
        service.deleteCustomPrompt(deleteCustomPromptOptions).execute().getResult();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        DeleteCustomModelOptions deleteCustomModelOptions = new DeleteCustomModelOptions.Builder().customizationId(customizationId).build();
        service.deleteCustomModel(deleteCustomModelOptions).execute().getResult();
    }
}
Also used : CreateCustomModelOptions(com.ibm.watson.text_to_speech.v1.model.CreateCustomModelOptions) AddCustomPromptOptions(com.ibm.watson.text_to_speech.v1.model.AddCustomPromptOptions) DeleteCustomPromptOptions(com.ibm.watson.text_to_speech.v1.model.DeleteCustomPromptOptions) PromptMetadata(com.ibm.watson.text_to_speech.v1.model.PromptMetadata) Prompt(com.ibm.watson.text_to_speech.v1.model.Prompt) DeleteCustomModelOptions(com.ibm.watson.text_to_speech.v1.model.DeleteCustomModelOptions) File(java.io.File) CustomModel(com.ibm.watson.text_to_speech.v1.model.CustomModel) UnsupportedAudioFileException(javax.sound.sampled.UnsupportedAudioFileException) IOException(java.io.IOException) WatsonServiceTest(com.ibm.watson.common.WatsonServiceTest) Test(org.junit.Test)

Aggregations

DeleteCustomModelOptions (com.ibm.watson.text_to_speech.v1.model.DeleteCustomModelOptions)6 CreateCustomModelOptions (com.ibm.watson.text_to_speech.v1.model.CreateCustomModelOptions)5 CustomModel (com.ibm.watson.text_to_speech.v1.model.CustomModel)5 WatsonServiceTest (com.ibm.watson.common.WatsonServiceTest)4 File (java.io.File)4 Test (org.junit.Test)4 AddCustomPromptOptions (com.ibm.watson.text_to_speech.v1.model.AddCustomPromptOptions)3 Prompt (com.ibm.watson.text_to_speech.v1.model.Prompt)3 PromptMetadata (com.ibm.watson.text_to_speech.v1.model.PromptMetadata)3 IOException (java.io.IOException)3 UnsupportedAudioFileException (javax.sound.sampled.UnsupportedAudioFileException)3 Authenticator (com.ibm.cloud.sdk.core.security.Authenticator)1 IamAuthenticator (com.ibm.cloud.sdk.core.security.IamAuthenticator)1 AddWordOptions (com.ibm.watson.text_to_speech.v1.model.AddWordOptions)1 AddWordsOptions (com.ibm.watson.text_to_speech.v1.model.AddWordsOptions)1 CustomModels (com.ibm.watson.text_to_speech.v1.model.CustomModels)1 DeleteCustomPromptOptions (com.ibm.watson.text_to_speech.v1.model.DeleteCustomPromptOptions)1 DeleteWordOptions (com.ibm.watson.text_to_speech.v1.model.DeleteWordOptions)1 GetCustomPromptOptions (com.ibm.watson.text_to_speech.v1.model.GetCustomPromptOptions)1 GetWordOptions (com.ibm.watson.text_to_speech.v1.model.GetWordOptions)1