Search in sources :

Example 6 with AddWordsOptions

use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.AddWordsOptions in project java-sdk by watson-developer-cloud.

the class CustomizationsIT method testGetWordJapanese.

/**
 * Test get word for Japanese.
 */
@Test
public void testGetWordJapanese() {
    model = createVoiceModelJapanese();
    final List<Word> expected = instantiateWordsJapanese();
    AddWordsOptions addOptions = new AddWordsOptions.Builder().customizationId(model.getCustomizationId()).words(expected).build();
    service.addWords(addOptions).execute();
    GetWordOptions getOptions = new GetWordOptions.Builder().customizationId(model.getCustomizationId()).word(expected.get(0).getWord()).build();
    final Translation translation = service.getWord(getOptions).execute();
    assertEquals(expected.get(0).getTranslation(), translation.getTranslation());
    assertEquals(expected.get(0).getPartOfSpeech(), translation.getPartOfSpeech());
}
Also used : Translation(com.ibm.watson.developer_cloud.text_to_speech.v1.model.Translation) Word(com.ibm.watson.developer_cloud.text_to_speech.v1.model.Word) AddWordsOptions(com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordsOptions) GetWordOptions(com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetWordOptions) WatsonServiceTest(com.ibm.watson.developer_cloud.WatsonServiceTest) Test(org.junit.Test)

Example 7 with AddWordsOptions

use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.AddWordsOptions in project java-sdk by watson-developer-cloud.

the class CustomizationsTest method testAddWords.

/**
 * Test add words.
 *
 * @throws InterruptedException the interrupted exception
 */
@Test
public void testAddWords() throws InterruptedException {
    final List<Word> expected = instantiateWords();
    server.enqueue(new MockResponse().setResponseCode(201));
    AddWordsOptions addOptions = new AddWordsOptions.Builder().customizationId(CUSTOMIZATION_ID).words(expected).build();
    service.addWords(addOptions).execute();
    RecordedRequest request = server.takeRequest();
    assertEquals(String.format(WORDS_PATH, CUSTOMIZATION_ID), request.getPath());
    assertEquals("POST", request.getMethod());
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) MockResponse(okhttp3.mockwebserver.MockResponse) Word(com.ibm.watson.developer_cloud.text_to_speech.v1.model.Word) AddWordsOptions(com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordsOptions) WatsonServiceUnitTest(com.ibm.watson.developer_cloud.WatsonServiceUnitTest) Test(org.junit.Test)

Aggregations

AddWordsOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordsOptions)6 Word (com.ibm.watson.developer_cloud.text_to_speech.v1.model.Word)6 Test (org.junit.Test)6 WatsonServiceTest (com.ibm.watson.developer_cloud.WatsonServiceTest)4 GetWordOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.GetWordOptions)3 ListWordsOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.ListWordsOptions)3 Translation (com.ibm.watson.developer_cloud.text_to_speech.v1.model.Translation)3 Words (com.ibm.watson.developer_cloud.text_to_speech.v1.model.Words)3 WatsonServiceUnitTest (com.ibm.watson.developer_cloud.WatsonServiceUnitTest)2 MockResponse (okhttp3.mockwebserver.MockResponse)2 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)2 JsonObject (com.google.gson.JsonObject)1 AddWordsOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.AddWordsOptions)1 CustomWord (com.ibm.watson.developer_cloud.speech_to_text.v1.model.CustomWord)1 Word (com.ibm.watson.developer_cloud.speech_to_text.v1.model.Word)1 AddWordOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.AddWordOptions)1 CreateVoiceModelOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.CreateVoiceModelOptions)1 DeleteVoiceModelOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.DeleteVoiceModelOptions)1 DeleteWordOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.DeleteWordOptions)1 ListVoiceModelsOptions (com.ibm.watson.developer_cloud.text_to_speech.v1.model.ListVoiceModelsOptions)1