Search in sources :

Example 6 with Corpora

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

the class SpeechToText method getCorpus.

/**
 * Lists information about a corpus for a custom language model.
 *
 * Lists information about a corpus from a custom language model. The information includes the total number of words
 * and out-of-vocabulary (OOV) words, name, and status of the corpus. You must use credentials for the instance of the
 * service that owns a model to list its corpora.
 *
 * @param getCorpusOptions the {@link GetCorpusOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link Corpus}
 */
public ServiceCall<Corpus> getCorpus(GetCorpusOptions getCorpusOptions) {
    Validator.notNull(getCorpusOptions, "getCorpusOptions cannot be null");
    String[] pathSegments = { "v1/customizations", "corpora" };
    String[] pathParameters = { getCorpusOptions.customizationId(), getCorpusOptions.corpusName() };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Corpus.class));
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) Corpus(com.ibm.watson.developer_cloud.speech_to_text.v1.model.Corpus)

Example 7 with Corpora

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

the class SpeechToText method listWords.

/**
 * Lists all custom words from a custom language model.
 *
 * Lists information about custom words from a custom language model. You can list all words from the custom model's
 * words resource, only custom words that were added or modified by the user, or only out-of-vocabulary (OOV) words
 * that were extracted from corpora. You can also indicate the order in which the service is to return words; by
 * default, words are listed in ascending alphabetical order. You must use credentials for the instance of the service
 * that owns a model to query information about its words.
 *
 * @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));
    if (listWordsOptions.wordType() != null) {
        builder.query("word_type", listWordsOptions.wordType());
    }
    if (listWordsOptions.sort() != null) {
        builder.query("sort", listWordsOptions.sort());
    }
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Words.class));
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) Words(com.ibm.watson.developer_cloud.speech_to_text.v1.model.Words)

Aggregations

Corpora (com.ibm.watson.developer_cloud.speech_to_text.v1.model.Corpora)5 ListCorporaOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.ListCorporaOptions)4 RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)3 Words (com.ibm.watson.developer_cloud.speech_to_text.v1.model.Words)3 Test (org.junit.Test)3 WatsonServiceTest (com.ibm.watson.developer_cloud.WatsonServiceTest)2 AddCorpusOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.AddCorpusOptions)2 AddWordOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.AddWordOptions)2 Corpus (com.ibm.watson.developer_cloud.speech_to_text.v1.model.Corpus)2 CreateLanguageModelOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.CreateLanguageModelOptions)2 DeleteLanguageModelOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.DeleteLanguageModelOptions)2 GetCorpusOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.GetCorpusOptions)2 LanguageModel (com.ibm.watson.developer_cloud.speech_to_text.v1.model.LanguageModel)2 ListWordsOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.ListWordsOptions)2 File (java.io.File)2 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1 WatsonServiceUnitTest (com.ibm.watson.developer_cloud.WatsonServiceUnitTest)1 GetLanguageModelOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.GetLanguageModelOptions)1 RecognizeOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.RecognizeOptions)1