use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.Words in project java-sdk by watson-developer-cloud.
the class TextToSpeech method listWords.
/**
* Queries details about the words in a custom voice model.
*
* Lists all of the words and their translations for the custom voice model with the specified `customization_id`. The
* output shows the translations as they are defined in the model. You must use credentials for the instance of the
* service that owns a model to query information about its words. **Note:** This method is currently a beta release.
*
* @param listWordsOptions the {@link ListWordsOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Words}
*/
public ServiceCall<Words> listWords(ListWordsOptions listWordsOptions) {
Validator.notNull(listWordsOptions, "listWordsOptions cannot be null");
String[] pathSegments = { "v1/customizations", "words" };
String[] pathParameters = { listWordsOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Words.class));
}
use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.Words in project java-sdk by watson-developer-cloud.
the class SpeechToText method listCorpora.
/**
* Lists information about all corpora for a custom language model.
*
* Lists information about all corpora from a custom language model. The information includes the total number of
* words and out-of-vocabulary (OOV) words, name, and status of each corpus. You must use credentials for the instance
* of the service that owns a model to list its corpora.
*
* @param listCorporaOptions the {@link ListCorporaOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link Corpora}
*/
public ServiceCall<Corpora> listCorpora(ListCorporaOptions listCorporaOptions) {
Validator.notNull(listCorporaOptions, "listCorporaOptions cannot be null");
String[] pathSegments = { "v1/customizations", "corpora" };
String[] pathParameters = { listCorporaOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Corpora.class));
}
use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.Words in project java-sdk by watson-developer-cloud.
the class CustomizationsIT method testAddWordsJapanese.
/**
* Test add words and list words for Japanese.
*/
@Test
public void testAddWordsJapanese() {
model = createVoiceModelJapanese();
final List<Word> expected = instantiateWordsJapanese();
AddWordsOptions addOptions = new AddWordsOptions.Builder().customizationId(model.getCustomizationId()).words(expected).build();
service.addWords(addOptions).execute();
ListWordsOptions listOptions = new ListWordsOptions.Builder().customizationId(model.getCustomizationId()).build();
final Words words = service.listWords(listOptions).execute();
assertEquals(expected.size(), words.getWords().size());
}
use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.Words in project java-sdk by watson-developer-cloud.
the class CustomizationsIT method testDeleteWord.
/**
* Test delete word with string.
*/
@Test
public void testDeleteWord() {
model = createVoiceModel();
final Word expected = instantiateWords().get(0);
AddWordOptions addOptions = new AddWordOptions.Builder().word(expected.getWord()).translation(expected.getTranslation()).customizationId(model.getCustomizationId()).build();
service.addWord(addOptions).execute();
DeleteWordOptions deleteOptions = new DeleteWordOptions.Builder().customizationId(model.getCustomizationId()).word(expected.getWord()).build();
service.deleteWord(deleteOptions).execute();
ListWordsOptions listOptions = new ListWordsOptions.Builder().customizationId(model.getCustomizationId()).build();
final Words results = service.listWords(listOptions).execute();
assertEquals(0, results.getWords().size());
}
use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.Words in project java-sdk by watson-developer-cloud.
the class CustomizationsIT method testAddWord.
/**
* Test add word.
*/
@Test
public void testAddWord() {
model = createVoiceModel();
final Word expected = instantiateWords().get(0);
AddWordOptions addOptions = new AddWordOptions.Builder().word(expected.getWord()).translation(expected.getTranslation()).customizationId(model.getCustomizationId()).build();
service.addWord(addOptions).execute();
ListWordsOptions listOptions = new ListWordsOptions.Builder().customizationId(model.getCustomizationId()).build();
final Words results = service.listWords(listOptions).execute();
assertEquals(1, results.getWords().size());
final Word result = results.getWords().get(0);
assertEquals(expected, result);
assertEquals(expected.getWord(), result.getWord());
assertEquals(expected.getTranslation(), result.getTranslation());
}
Aggregations