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());
}
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());
}
Aggregations