use of com.ibm.watson.speech_to_text.v1.model.Corpus in project java-sdk by watson-developer-cloud.
the class SpeechToText method getCorpus.
/**
* Get a corpus.
*
* <p>Gets information about a corpus from a custom language model. The information includes the
* name, status, and total number of words for the corpus. _For custom models that are based on
* previous-generation models_, it also includes the number of out-of-vocabulary (OOV) words from
* the corpus. You must use credentials for the instance of the service that owns a model to list
* its corpora.
*
* <p>**See also:** [Listing corpora for a custom language
* model](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-manageCorpora#listCorpora).
*
* @param getCorpusOptions the {@link GetCorpusOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link Corpus}
*/
public ServiceCall<Corpus> getCorpus(GetCorpusOptions getCorpusOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(getCorpusOptions, "getCorpusOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("customization_id", getCorpusOptions.customizationId());
pathParamsMap.put("corpus_name", getCorpusOptions.corpusName());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/customizations/{customization_id}/corpora/{corpus_name}", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getCorpus");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
ResponseConverter<Corpus> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<Corpus>() {
}.getType());
return createServiceCall(builder.build(), responseConverter);
}
Aggregations