use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class SpeechToText method resetAcousticModel.
/**
* Resets a custom acoustic model.
*
* Resets a custom acoustic model by removing all audio resources from the model. Resetting a custom acoustic model
* initializes the model to its state when it was first created. Metadata such as the name and language of the model
* are preserved, but the model's audio resources are removed and must be re-created. You must use credentials for the
* instance of the service that owns a model to reset it.
*
* @param resetAcousticModelOptions the {@link ResetAcousticModelOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
public ServiceCall<Void> resetAcousticModel(ResetAcousticModelOptions resetAcousticModelOptions) {
Validator.notNull(resetAcousticModelOptions, "resetAcousticModelOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "reset" };
String[] pathParameters = { resetAcousticModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class SpeechToText method getLanguageModel.
/**
* Lists information about a custom language model.
*
* Lists information about a specified custom language model. You must use credentials for the instance of the service
* that owns a model to list information about it.
*
* @param getLanguageModelOptions the {@link GetLanguageModelOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link LanguageModel}
*/
public ServiceCall<LanguageModel> getLanguageModel(GetLanguageModelOptions getLanguageModelOptions) {
Validator.notNull(getLanguageModelOptions, "getLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
String[] pathParameters = { getLanguageModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModel.class));
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class SpeechToText method createLanguageModel.
/**
* Creates a custom language model.
*
* Creates a new custom language model for a specified base model. The custom language model can be used only with the
* base model for which it is created. The model is owned by the instance of the service whose credentials are used to
* create it.
*
* @param createLanguageModelOptions the {@link CreateLanguageModelOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link LanguageModel}
*/
public ServiceCall<LanguageModel> createLanguageModel(CreateLanguageModelOptions createLanguageModelOptions) {
Validator.notNull(createLanguageModelOptions, "createLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("name", createLanguageModelOptions.name());
contentJson.addProperty("base_model_name", createLanguageModelOptions.baseModelName());
if (createLanguageModelOptions.dialect() != null) {
contentJson.addProperty("dialect", createLanguageModelOptions.dialect());
}
if (createLanguageModelOptions.description() != null) {
contentJson.addProperty("description", createLanguageModelOptions.description());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModel.class));
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class SpeechToText method getAudio.
/**
* Lists information about an audio resource for a custom acoustic model.
*
* Lists information about an audio resource from a custom acoustic model. The method returns an `AudioListing` object
* whose fields depend on the type of audio resource you specify with the method's `audio_name` parameter: * **For an
* audio-type resource,** the object's fields match those of an `AudioResource` object: `duration`, `name`, `details`,
* and `status`. * **For an archive-type resource,** the object includes a `container` field whose fields match those
* of an `AudioResource` object. It also includes an `audio` field, which contains an array of `AudioResource` objects
* that provides information about the audio files that are contained in the archive. The information includes the
* status of the specified audio resource, which is important for checking the service's analysis of the resource in
* response to a request to add it to the custom model. You must use credentials for the instance of the service that
* owns a model to list its audio resources.
*
* @param getAudioOptions the {@link GetAudioOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link AudioListing}
*/
public ServiceCall<AudioListing> getAudio(GetAudioOptions getAudioOptions) {
Validator.notNull(getAudioOptions, "getAudioOptions cannot be null");
String[] pathSegments = { "v1/acoustic_customizations", "audio" };
String[] pathParameters = { getAudioOptions.customizationId(), getAudioOptions.audioName() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AudioListing.class));
}
use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.
the class SpeechToText method deleteLanguageModel.
/**
* Deletes a custom language model.
*
* Deletes an existing custom language model. The custom model cannot be deleted if another request, such as adding a
* corpus to the model, is currently being processed. You must use credentials for the instance of the service that
* owns a model to delete it.
*
* @param deleteLanguageModelOptions the {@link DeleteLanguageModelOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of Void
*/
public ServiceCall<Void> deleteLanguageModel(DeleteLanguageModelOptions deleteLanguageModelOptions) {
Validator.notNull(deleteLanguageModelOptions, "deleteLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
String[] pathParameters = { deleteLanguageModelOptions.customizationId() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
Aggregations