Skip to content

Commit d597080

Browse files
committed
refactor(STT): remove strict from parameters
1 parent 2f68e22 commit d597080

File tree

1 file changed

+11
-48
lines changed

1 file changed

+11
-48
lines changed

lib/ibm_watson/speech_to_text_v1.rb

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def get_model(model_id:)
162162
#########################
163163

164164
##
165-
# @!method recognize(audio:, model: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, processing_metrics: nil, processing_metrics_interval: nil, audio_metrics: nil, content_type: nil)
165+
# @!method recognize(audio:, model: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, audio_metrics: nil, content_type: nil)
166166
# Recognize audio.
167167
# Sends audio and returns transcription results for a recognition request. You can
168168
# pass a maximum of 100 MB and a minimum of 100 bytes of audio with a request. The
@@ -379,29 +379,16 @@ def get_model(model_id:)
379379
#
380380
# See [Numeric
381381
# redaction](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#redaction).
382-
# @param processing_metrics [Boolean] If `true`, requests processing metrics about the service's transcription of the
383-
# input audio. The service returns processing metrics at the interval specified by
384-
# the `processing_metrics_interval` parameter. It also returns processing metrics
385-
# for transcription events, for example, for final and interim results. By default,
386-
# the service returns no processing metrics.
387-
# @param processing_metrics_interval [Float] Specifies the interval in real wall-clock seconds at which the service is to
388-
# return processing metrics. The parameter is ignored unless the
389-
# `processing_metrics` parameter is set to `true`.
390-
#
391382
# The parameter accepts a minimum value of 0.1 seconds. The level of precision is
392383
# not restricted, so you can specify values such as 0.25 and 0.125.
393384
#
394-
# The service does not impose a maximum value. If you want to receive processing
395-
# metrics only for transcription events instead of at periodic intervals, set the
396-
# value to a large number. If the value is larger than the duration of the audio,
397-
# the service returns processing metrics only for transcription events.
398385
# @param audio_metrics [Boolean] If `true`, requests detailed information about the signal characteristics of the
399386
# input audio. The service returns audio metrics with the final transcription
400387
# results. By default, the service returns no audio metrics.
401388
# @param content_type [String] The format (MIME type) of the audio. For more information about specifying an
402389
# audio format, see **Audio formats (content types)** in the method description.
403390
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
404-
def recognize(audio:, model: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, processing_metrics: nil, processing_metrics_interval: nil, audio_metrics: nil, content_type: nil)
391+
def recognize(audio:, model: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, audio_metrics: nil, content_type: nil)
405392
raise ArgumentError.new("audio must be provided") if audio.nil?
406393

407394
headers = {
@@ -430,8 +417,6 @@ def recognize(audio:, model: nil, language_customization_id: nil, acoustic_custo
430417
"customization_id" => customization_id,
431418
"grammar_name" => grammar_name,
432419
"redaction" => redaction,
433-
"processing_metrics" => processing_metrics,
434-
"processing_metrics_interval" => processing_metrics_interval,
435420
"audio_metrics" => audio_metrics
436421
}
437422

@@ -699,7 +684,7 @@ def unregister_callback(callback_url:)
699684
end
700685

701686
##
702-
# @!method create_job(audio:, model: nil, callback_url: nil, events: nil, user_token: nil, results_ttl: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, processing_metrics: nil, processing_metrics_interval: nil, audio_metrics: nil, content_type: nil)
687+
# @!method create_job(audio:, model: nil, callback_url: nil, events: nil, user_token: nil, results_ttl: nil, language_customization_id: nil, acoustic_customization_id: nil, base_model_version: nil, customization_weight: nil, inactivity_timeout: nil, keywords: nil, keywords_threshold: nil, max_alternatives: nil, word_alternatives_threshold: nil, word_confidence: nil, timestamps: nil, profanity_filter: nil, smart_formatting: nil, speaker_labels: nil, customization_id: nil, grammar_name: nil, redaction: nil, audio_metrics: nil, content_type: nil)
703688
# Create a job.
704689
# Creates a job for a new asynchronous recognition request. The job is owned by the
705690
# instance of the service whose credentials are used to create it. How you learn the
@@ -960,16 +945,15 @@ def unregister_callback(callback_url:)
960945
#
961946
# See [Numeric
962947
# redaction](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-output#redaction).
948+
#
963949
# @param processing_metrics [Boolean] If `true`, requests processing metrics about the service's transcription of the
964950
# input audio. The service returns processing metrics at the interval specified by
965951
# the `processing_metrics_interval` parameter. It also returns processing metrics
966952
# for transcription events, for example, for final and interim results. By default,
967953
# the service returns no processing metrics.
968954
# @param processing_metrics_interval [Float] Specifies the interval in real wall-clock seconds at which the service is to
969955
# return processing metrics. The parameter is ignored unless the
970-
# `processing_metrics` parameter is set to `true`.
971-
#
972-
# The parameter accepts a minimum value of 0.1 seconds. The level of precision is
956+
# `processing_metrics` parameter is set to `true`. # The parameter accepts a minimum value of 0.1 seconds. The level of precision is
973957
# not restricted, so you can specify values such as 0.25 and 0.125.
974958
#
975959
# The service does not impose a maximum value. If you want to receive processing
@@ -1310,7 +1294,7 @@ def delete_language_model(customization_id:)
13101294
end
13111295

13121296
##
1313-
# @!method train_language_model(customization_id:, word_type_to_add: nil, customization_weight: nil, strict: nil)
1297+
# @!method train_language_model(customization_id:, word_type_to_add: nil, customization_weight: nil)
13141298
# Train a custom language model.
13151299
# Initiates the training of a custom language model with new resources such as
13161300
# corpora, grammars, and custom words. After adding, modifying, or deleting
@@ -1342,11 +1326,6 @@ def delete_language_model(customization_id:)
13421326
# * The service is currently handling another request for the custom model, such as
13431327
# another training request or a request to add a corpus or grammar to the model.
13441328
# * No training data have been added to the custom model.
1345-
# * The custom model contains one or more invalid corpora, grammars, or words (for
1346-
# example, a custom word has an invalid sounds-like pronunciation). You can correct
1347-
# the invalid resources or set the `strict` parameter to `false` to exclude the
1348-
# invalid resources from the training. The model must contain at least one valid
1349-
# resource for training to succeed.
13501329
# @param customization_id [String] The customization ID (GUID) of the custom language model that is to be used for
13511330
# the request. You must make the request with credentials for the instance of the
13521331
# service that owns the custom model.
@@ -1372,13 +1351,8 @@ def delete_language_model(customization_id:)
13721351
# The value that you assign is used for all recognition requests that use the model.
13731352
# You can override it for any recognition request by specifying a customization
13741353
# weight for that request.
1375-
# @param strict [Boolean] If `false`, allows training of the custom language model to proceed as long as the
1376-
# model contains at least one valid resource. The method returns an array of
1377-
# `TrainingWarning` objects that lists any invalid resources. By default (`true`),
1378-
# training of a custom language model fails (status code 400) if the model contains
1379-
# one or more invalid resources (corpus files, grammar files, or custom words).
13801354
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1381-
def train_language_model(customization_id:, word_type_to_add: nil, customization_weight: nil, strict: nil)
1355+
def train_language_model(customization_id:, word_type_to_add: nil, customization_weight: nil)
13821356
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
13831357

13841358
headers = {
@@ -1388,8 +1362,7 @@ def train_language_model(customization_id:, word_type_to_add: nil, customization
13881362

13891363
params = {
13901364
"word_type_to_add" => word_type_to_add,
1391-
"customization_weight" => customization_weight,
1392-
"strict" => strict
1365+
"customization_weight" => customization_weight
13931366
}
13941367

13951368
method_url = "/v1/customizations/%s/train" % [ERB::Util.url_encode(customization_id)]
@@ -2405,7 +2378,7 @@ def delete_acoustic_model(customization_id:)
24052378
end
24062379

24072380
##
2408-
# @!method train_acoustic_model(customization_id:, custom_language_model_id: nil, strict: nil)
2381+
# @!method train_acoustic_model(customization_id:, custom_language_model_id: nil)
24092382
# Train a custom acoustic model.
24102383
# Initiates the training of a custom acoustic model with new or changed audio
24112384
# resources. After adding or deleting audio resources for a custom acoustic model,
@@ -2455,10 +2428,6 @@ def delete_acoustic_model(customization_id:)
24552428
# * You passed an incompatible custom language model with the
24562429
# `custom_language_model_id` query parameter. Both custom models must be based on
24572430
# the same version of the same base model.
2458-
# * The custom model contains one or more invalid audio resources. You can correct
2459-
# the invalid audio resources or set the `strict` parameter to `false` to exclude
2460-
# the invalid resources from the training. The model must contain at least one valid
2461-
# resource for training to succeed.
24622431
# @param customization_id [String] The customization ID (GUID) of the custom acoustic model that is to be used for
24632432
# the request. You must make the request with credentials for the instance of the
24642433
# service that owns the custom model.
@@ -2469,13 +2438,8 @@ def delete_acoustic_model(customization_id:)
24692438
# language model must be based on the same version of the same base model as the
24702439
# custom acoustic model. The credentials specified with the request must own both
24712440
# custom models.
2472-
# @param strict [Boolean] If `false`, allows training of the custom acoustic model to proceed as long as the
2473-
# model contains at least one valid audio resource. The method returns an array of
2474-
# `TrainingWarning` objects that lists any invalid resources. By default (`true`),
2475-
# training of a custom acoustic model fails (status code 400) if the model contains
2476-
# one or more invalid audio resources.
24772441
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2478-
def train_acoustic_model(customization_id:, custom_language_model_id: nil, strict: nil)
2442+
def train_acoustic_model(customization_id:, custom_language_model_id: nil)
24792443
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
24802444

24812445
headers = {
@@ -2484,8 +2448,7 @@ def train_acoustic_model(customization_id:, custom_language_model_id: nil, stric
24842448
headers.merge!(sdk_headers)
24852449

24862450
params = {
2487-
"custom_language_model_id" => custom_language_model_id,
2488-
"strict" => strict
2451+
"custom_language_model_id" => custom_language_model_id
24892452
}
24902453

24912454
method_url = "/v1/acoustic_customizations/%s/train" % [ERB::Util.url_encode(customization_id)]

0 commit comments

Comments
 (0)