Search in sources :

Example 6 with LanguageModel

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

the class SpeechToTextTest method testCreateLanguageModel.

/**
 * Test create language model.
 *
 * @throws InterruptedException the interrupted exception
 * @throws FileNotFoundException the file not found exception
 */
@Test
public void testCreateLanguageModel() throws InterruptedException, FileNotFoundException {
    LanguageModel model = loadFixture("src/test/resources/speech_to_text/customization.json", LanguageModel.class);
    server.enqueue(new MockResponse().addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON).setBody(GSON.toJson(model)));
    CreateLanguageModelOptions createOptions = new CreateLanguageModelOptions.Builder().name(model.getName()).baseModelName("en-GB_BroadbandModel").description(model.getDescription()).build();
    LanguageModel result = service.createLanguageModel(createOptions).execute();
    final RecordedRequest request = server.takeRequest();
    assertEquals("POST", request.getMethod());
    assertEquals(PATH_CUSTOMIZATIONS, request.getPath());
    assertEquals(result.toString(), model.toString());
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) MockResponse(okhttp3.mockwebserver.MockResponse) CreateLanguageModelOptions(com.ibm.watson.developer_cloud.speech_to_text.v1.model.CreateLanguageModelOptions) LanguageModel(com.ibm.watson.developer_cloud.speech_to_text.v1.model.LanguageModel) WatsonServiceUnitTest(com.ibm.watson.developer_cloud.WatsonServiceUnitTest) Test(org.junit.Test)

Aggregations

LanguageModel (com.ibm.watson.developer_cloud.speech_to_text.v1.model.LanguageModel)6 CreateLanguageModelOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.CreateLanguageModelOptions)3 Test (org.junit.Test)3 WatsonServiceUnitTest (com.ibm.watson.developer_cloud.WatsonServiceUnitTest)2 RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)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 Corpora (com.ibm.watson.developer_cloud.speech_to_text.v1.model.Corpora)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 GetLanguageModelOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.GetLanguageModelOptions)2 ListCorporaOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.ListCorporaOptions)2 ListWordsOptions (com.ibm.watson.developer_cloud.speech_to_text.v1.model.ListWordsOptions)2 Words (com.ibm.watson.developer_cloud.speech_to_text.v1.model.Words)2 File (java.io.File)2 MockResponse (okhttp3.mockwebserver.MockResponse)2 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)2 JsonObject (com.google.gson.JsonObject)1 WatsonServiceTest (com.ibm.watson.developer_cloud.WatsonServiceTest)1 Corpus (com.ibm.watson.developer_cloud.speech_to_text.v1.model.Corpus)1