Skip to content

Commit cdcc228

Browse files
feat(stt): add and remove method parameters
Remove parameter `customizationId` from `createJob` and `recognize`. Add parameter `characterInsertionBias` to `createJob` and `recognize`. Add parameter `strict` to `trainAcousticModel` and `trainLanguageModel`. Add new stt models
1 parent 680d2c0 commit cdcc228

File tree

7 files changed

+293
-111
lines changed

7 files changed

+293
-111
lines changed

speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java

+50-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2016, 2022.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -12,7 +12,7 @@
1212
*/
1313

1414
/*
15-
* IBM OpenAPI SDK Code Generator Version: 3.46.0-a4e29da0-20220224-210428
15+
* IBM OpenAPI SDK Code Generator Version: 3.53.0-9710cac3-20220713-193508
1616
*/
1717

1818
package com.ibm.watson.speech_to_text.v1;
@@ -329,9 +329,15 @@ public ServiceCall<SpeechModel> getModel(GetModelOptions getModelOptions) {
329329
* accuracy.
330330
*
331331
* <p>You specify a next-generation model by using the `model` query parameter, as you do a
332-
* previous-generation model. Many next-generation models also support the `low_latency`
333-
* parameter, which is not available with previous-generation models. Next-generation models do
334-
* not support all of the parameters that are available for use with previous-generation models.
332+
* previous-generation model. Most next-generation models support the `low_latency` parameter, and
333+
* all next-generation models support the `character_insertion_bias` parameter. These parameters
334+
* are not available with previous-generation models.
335+
*
336+
* <p>Next-generation models do not support all of the speech recognition parameters that are
337+
* available for use with previous-generation models. Next-generation models do not support the
338+
* following parameters: * `acoustic_customization_id` * `keywords` and `keywords_threshold` *
339+
* `max_alternatives` * `processing_metrics` and `processing_metrics_interval` *
340+
* `word_alternatives_threshold`
335341
*
336342
* <p>**Important:** Effective 15 March 2022, previous-generation models for all languages other
337343
* than Arabic and Japanese are deprecated. The deprecated models remain available until 15
@@ -429,9 +435,6 @@ public ServiceCall<SpeechRecognitionResults> recognize(RecognizeOptions recogniz
429435
if (recognizeOptions.speakerLabels() != null) {
430436
builder.query("speaker_labels", String.valueOf(recognizeOptions.speakerLabels()));
431437
}
432-
if (recognizeOptions.customizationId() != null) {
433-
builder.query("customization_id", String.valueOf(recognizeOptions.customizationId()));
434-
}
435438
if (recognizeOptions.grammarName() != null) {
436439
builder.query("grammar_name", String.valueOf(recognizeOptions.grammarName()));
437440
}
@@ -463,6 +466,10 @@ public ServiceCall<SpeechRecognitionResults> recognize(RecognizeOptions recogniz
463466
if (recognizeOptions.lowLatency() != null) {
464467
builder.query("low_latency", String.valueOf(recognizeOptions.lowLatency()));
465468
}
469+
if (recognizeOptions.characterInsertionBias() != null) {
470+
builder.query(
471+
"character_insertion_bias", String.valueOf(recognizeOptions.characterInsertionBias()));
472+
}
466473
builder.bodyContent(recognizeOptions.contentType(), null, null, recognizeOptions.audio());
467474
ResponseConverter<SpeechRecognitionResults> responseConverter =
468475
ResponseConverterUtils.getValue(
@@ -702,9 +709,15 @@ public ServiceCall<Void> unregisterCallback(UnregisterCallbackOptions unregister
702709
* accuracy.
703710
*
704711
* <p>You specify a next-generation model by using the `model` query parameter, as you do a
705-
* previous-generation model. Many next-generation models also support the `low_latency`
706-
* parameter, which is not available with previous-generation models. Next-generation models do
707-
* not support all of the parameters that are available for use with previous-generation models.
712+
* previous-generation model. Most next-generation models support the `low_latency` parameter, and
713+
* all next-generation models support the `character_insertion_bias` parameter. These parameters
714+
* are not available with previous-generation models.
715+
*
716+
* <p>Next-generation models do not support all of the speech recognition parameters that are
717+
* available for use with previous-generation models. Next-generation models do not support the
718+
* following parameters: * `acoustic_customization_id` * `keywords` and `keywords_threshold` *
719+
* `max_alternatives` * `processing_metrics` and `processing_metrics_interval` *
720+
* `word_alternatives_threshold`
708721
*
709722
* <p>**Important:** Effective 15 March 2022, previous-generation models for all languages other
710723
* than Arabic and Japanese are deprecated. The deprecated models remain available until 15
@@ -795,9 +808,6 @@ public ServiceCall<RecognitionJob> createJob(CreateJobOptions createJobOptions)
795808
if (createJobOptions.speakerLabels() != null) {
796809
builder.query("speaker_labels", String.valueOf(createJobOptions.speakerLabels()));
797810
}
798-
if (createJobOptions.customizationId() != null) {
799-
builder.query("customization_id", String.valueOf(createJobOptions.customizationId()));
800-
}
801811
if (createJobOptions.grammarName() != null) {
802812
builder.query("grammar_name", String.valueOf(createJobOptions.grammarName()));
803813
}
@@ -837,6 +847,10 @@ public ServiceCall<RecognitionJob> createJob(CreateJobOptions createJobOptions)
837847
if (createJobOptions.lowLatency() != null) {
838848
builder.query("low_latency", String.valueOf(createJobOptions.lowLatency()));
839849
}
850+
if (createJobOptions.characterInsertionBias() != null) {
851+
builder.query(
852+
"character_insertion_bias", String.valueOf(createJobOptions.characterInsertionBias()));
853+
}
840854
builder.bodyContent(createJobOptions.contentType(), null, null, createJobOptions.audio());
841855
ResponseConverter<RecognitionJob> responseConverter =
842856
ResponseConverterUtils.getValue(
@@ -1217,6 +1231,9 @@ public ServiceCall<TrainingResponse> trainLanguageModel(
12171231
builder.query(
12181232
"customization_weight", String.valueOf(trainLanguageModelOptions.customizationWeight()));
12191233
}
1234+
if (trainLanguageModelOptions.strict() != null) {
1235+
builder.query("strict", String.valueOf(trainLanguageModelOptions.strict()));
1236+
}
12201237
ResponseConverter<TrainingResponse> responseConverter =
12211238
ResponseConverterUtils.getValue(
12221239
new com.google.gson.reflect.TypeToken<TrainingResponse>() {}.getType());
@@ -1374,7 +1391,7 @@ public ServiceCall<Corpora> listCorpora(ListCorporaOptions listCorporaOptions) {
13741391
* corpus, you must validate the words resource to ensure that each OOV word's definition is
13751392
* complete and valid. You can use the [List custom words](#listwords) method to examine the words
13761393
* resource. You can use other words method to eliminate typos and modify how words are pronounced
1377-
* as needed.
1394+
* and displayed as needed.
13781395
*
13791396
* <p>To add a corpus file that has the same name as an existing corpus, set the `allow_overwrite`
13801397
* parameter to `true`; otherwise, the request fails. Overwriting an existing corpus causes the
@@ -1520,7 +1537,10 @@ public ServiceCall<Void> deleteCorpus(DeleteCorpusOptions deleteCorpusOptions) {
15201537
* from the custom model's words resource, only custom words that were added or modified by the
15211538
* user, or, _for a custom model that is based on a previous-generation model_, only
15221539
* out-of-vocabulary (OOV) words that were extracted from corpora or are recognized by grammars.
1523-
* You can also indicate the order in which the service is to return words; by default, the
1540+
* _For a custom model that is based on a next-generation model_, you can list all words or only
1541+
* those words that were added directly by a user, which return the same results.
1542+
*
1543+
* <p>You can also indicate the order in which the service is to return words; by default, the
15241544
* service lists words in ascending alphabetical order. You must use credentials for the instance
15251545
* of the service that owns a model to list information about its words.
15261546
*
@@ -1580,15 +1600,15 @@ public ServiceCall<Words> listWords(ListWordsOptions listWordsOptions) {
15801600
* for each word. * The `display_as` field provides a different way of spelling the word in a
15811601
* transcript. Use the parameter when you want the word to appear different from its usual
15821602
* representation or from its spelling in training data. For example, you might indicate that the
1583-
* word `IBM` is to be displayed as `IBM&amp;trade;`. * The `sounds_like` field, _which can be
1584-
* used only with a custom model that is based on a previous-generation model_, provides an array
1603+
* word `IBM` is to be displayed as `IBM&amp;trade;`. * The `sounds_like` field provides an array
15851604
* of one or more pronunciations for the word. Use the parameter to specify how the word can be
15861605
* pronounced by users. Use the parameter for words that are difficult to pronounce, foreign
15871606
* words, acronyms, and so on. For example, you might specify that the word `IEEE` can sound like
1588-
* `i triple e`. You can specify a maximum of five sounds-like pronunciations for a word. If you
1589-
* omit the `sounds_like` field, the service attempts to set the field to its pronunciation of the
1590-
* word. It cannot generate a pronunciation for all words, so you must review the word's
1591-
* definition to ensure that it is complete and valid.
1607+
* `I triple E`. You can specify a maximum of five sounds-like pronunciations for a word. _For a
1608+
* custom model that is based on a previous-generation model_, if you omit the `sounds_like`
1609+
* field, the service attempts to set the field to its pronunciation of the word. It cannot
1610+
* generate a pronunciation for all words, so you must review the word's definition to ensure that
1611+
* it is complete and valid.
15921612
*
15931613
* <p>If you add a custom word that already exists in the words resource for the custom model, the
15941614
* new definition overwrites the existing data for the word. If the service encounters an error
@@ -1671,15 +1691,15 @@ public ServiceCall<Void> addWords(AddWordsOptions addWordsOptions) {
16711691
* `sounds_like` fields for the word. * The `display_as` field provides a different way of
16721692
* spelling the word in a transcript. Use the parameter when you want the word to appear different
16731693
* from its usual representation or from its spelling in training data. For example, you might
1674-
* indicate that the word `IBM` is to be displayed as `IBM&amp;trade;`. * The `sounds_like` field,
1675-
* _which can be used only with a custom model that is based on a previous-generation model_,
1694+
* indicate that the word `IBM` is to be displayed as `IBM&amp;trade;`. * The `sounds_like` field
16761695
* provides an array of one or more pronunciations for the word. Use the parameter to specify how
16771696
* the word can be pronounced by users. Use the parameter for words that are difficult to
16781697
* pronounce, foreign words, acronyms, and so on. For example, you might specify that the word
16791698
* `IEEE` can sound like `i triple e`. You can specify a maximum of five sounds-like
1680-
* pronunciations for a word. If you omit the `sounds_like` field, the service attempts to set the
1681-
* field to its pronunciation of the word. It cannot generate a pronunciation for all words, so
1682-
* you must review the word's definition to ensure that it is complete and valid.
1699+
* pronunciations for a word. _For custom models that are based on previous-generation models_, if
1700+
* you omit the `sounds_like` field, the service attempts to set the field to its pronunciation of
1701+
* the word. It cannot generate a pronunciation for all words, so you must review the word's
1702+
* definition to ensure that it is complete and valid.
16831703
*
16841704
* <p>If you add a custom word that already exists in the words resource for the custom model, the
16851705
* new definition overwrites the existing data for the word. If the service encounters an error,
@@ -2269,6 +2289,9 @@ public ServiceCall<TrainingResponse> trainAcousticModel(
22692289
"custom_language_model_id",
22702290
String.valueOf(trainAcousticModelOptions.customLanguageModelId()));
22712291
}
2292+
if (trainAcousticModelOptions.strict() != null) {
2293+
builder.query("strict", String.valueOf(trainAcousticModelOptions.strict()));
2294+
}
22722295
ResponseConverter<TrainingResponse> responseConverter =
22732296
ResponseConverterUtils.getValue(
22742297
new com.google.gson.reflect.TypeToken<TrainingResponse>() {}.getType());

0 commit comments

Comments
 (0)