You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Sends audio for speech recognition using web sockets.
431
+
# @param content_type [String] The type of the input: audio/basic, audio/flac, audio/l16, audio/mp3, audio/mpeg, audio/mulaw, audio/ogg, audio/ogg;codecs=opus, audio/ogg;codecs=vorbis, audio/wav, audio/webm, audio/webm;codecs=opus, audio/webm;codecs=vorbis, or multipart/form-data.
432
+
# @param recognize_callback [RecognizeCallback] The instance handling events returned from the service.
431
433
# @param audio [IO] Audio to transcribe in the format specified by the `Content-Type` header.
432
434
# @param chunk_data [Boolean] If true, then the WebSocketClient will expect to receive data in chunks rather than as a single audio file
433
-
# @param content_type [String] The type of the input: audio/basic, audio/flac, audio/l16, audio/mp3, audio/mpeg, audio/mulaw, audio/ogg, audio/ogg;codecs=opus, audio/ogg;codecs=vorbis, audio/wav, audio/webm, audio/webm;codecs=opus, audio/webm;codecs=vorbis, or multipart/form-data.
434
435
# @param model [String] The identifier of the model to be used for the recognition request.
435
-
# @param recognize_callback [RecognizeCallback] The instance handling events returned from the service.
436
436
# @param customization_id [String] The GUID of a custom language model that is to be used with the request. The base model of the specified custom language model must match the model specified with the `model` parameter. You must make the request with service credentials created for the instance of the service that owns the custom model. By default, no custom language model is used.
437
437
# @param acoustic_customization_id [String] The GUID of a custom acoustic model that is to be used with the request. The base model of the specified custom acoustic model must match the model specified with the `model` parameter. You must make the request with service credentials created for the instance of the service that owns the custom model. By default, no custom acoustic model is used.
438
438
# @param customization_weight [Float] If you specify a `customization_id` with the request, you can use the `customization_weight` parameter to tell the service how much weight to give to words from the custom language model compared to those from the base model for speech recognition. Specify a value between 0.0 and 1.0. Unless a different customization weight was specified for the custom model when it was trained, the default value is 0.3. A customization weight that you specify overrides a weight that was specified when the custom model was trained. The default value yields the best performance in general. Assign a higher value if your audio makes frequent use of OOV words from the custom model. Use caution when setting the weight: a higher value can improve the accuracy of phrases from the custom model's domain, but it can negatively affect performance on non-domain phrases.
439
-
# @param version [String] The version of the specified base `model` that is to be used for speech recognition. Multiple versions of a base model can exist when a model is updated for internal improvements. The parameter is intended primarily for use with custom models that have been upgraded for a new base model. The default value depends on whether the parameter is used with or without a custom model. For more information, see [Base model version](https://console.bluemix.net/docs/services/speech-to-text/input.html#version).
439
+
# @param base_model_version [String] The version of the specified base `model` that is to be used for speech recognition. Multiple versions of a base model can exist when a model is updated for internal improvements. The parameter is intended primarily for use with custom models that have been upgraded for a new base model. The default value depends on whether the parameter is used with or without a custom model. For more information, see [Base model version](https://console.bluemix.net/docs/services/speech-to-text/input.html#version).
440
440
# @param inactivity_timeout [Integer] The time in seconds after which, if only silence (no speech) is detected in submitted audio, the connection is closed with a 400 error. Useful for stopping audio submission from a live microphone when a user simply walks away. Use `-1` for infinity.
441
441
# @param interim_results [Boolean] Send back non-final previews of each "sentence" as it is being processed. These results are ignored in text mode.
442
442
# @param keywords [Array<String>] Array of keyword strings to spot in the audio. Each keyword string can include one or more tokens. Keywords are spotted only in the final hypothesis, not in interim results. If you specify any keywords, you must also specify a keywords threshold. Omit the parameter or specify an empty array if you do not need to spot keywords.
# @param speaker_labels [Boolean] Indicates whether labels that identify which words were spoken by which participants in a multi-person exchange are to be included in the response. The default is `false`; no speaker labels are returned. Setting `speaker_labels` to `true` forces the `timestamps` parameter to be `true`, regardless of whether you specify `false` for the parameter. To determine whether a language model supports speaker labels, use the `GET /v1/models` method and check that the attribute `speaker_labels` is set to `true`. You can also refer to [Speaker labels](https://console.bluemix.net/docs/services/speech-to-text/output.html#speaker_labels).
451
451
# @return [WebSocketClient] Returns a new WebSocketClient object
452
452
defrecognize_using_websocket(
453
+
content_type:,
454
+
recognize_callback:,
453
455
audio: nil,
454
456
chunk_data: false,
455
-
content_type: "audio/l16; rate=44100",
456
-
model: "en-US_BroadbandModel",
457
-
recognize_callback: nil,
457
+
model: nil,
458
458
customization_id: nil,
459
459
acoustic_customization_id: nil,
460
460
customization_weight: nil,
461
-
version: nil,
462
-
inactivity_timeout: 30,
463
-
interim_results: false,
461
+
base_model_version: nil,
462
+
inactivity_timeout: nil,
463
+
interim_results: nil,
464
464
keywords: nil,
465
465
keywords_threshold: nil,
466
-
max_alternatives: 1,
466
+
max_alternatives: nil,
467
467
word_alternatives_threshold: nil,
468
-
word_confidence: false,
469
-
timestamps: false,
468
+
word_confidence: nil,
469
+
timestamps: nil,
470
470
profanity_filter: nil,
471
-
smart_formatting: false,
471
+
smart_formatting: nil,
472
472
speaker_labels: nil
473
473
)
474
474
raiseArgumentError("Audio must be provided")ifaudio.nil? && !chunk_data
# @deprecated This will method be removed in the next major release. Use {#recognize_using_websocket} instead.
516
516
defrecognize_with_websocket(
517
+
content_type:,
518
+
recognize_callback:,
517
519
audio: nil,
518
520
chunk_data: false,
519
-
content_type: "audio/l16; rate=44100",
520
-
model: "en-US_BroadbandModel",
521
-
recognize_callback: nil,
521
+
model: nil,
522
522
customization_id: nil,
523
523
acoustic_customization_id: nil,
524
524
customization_weight: nil,
525
-
version: nil,
526
-
inactivity_timeout: 30,
527
-
interim_results: false,
525
+
base_model_version: nil,
526
+
inactivity_timeout: nil,
527
+
interim_results: nil,
528
528
keywords: nil,
529
529
keywords_threshold: nil,
530
-
max_alternatives: 1,
530
+
max_alternatives: nil,
531
531
word_alternatives_threshold: nil,
532
-
word_confidence: false,
533
-
timestamps: false,
532
+
word_confidence: nil,
533
+
timestamps: nil,
534
534
profanity_filter: nil,
535
-
smart_formatting: false,
535
+
smart_formatting: nil,
536
536
speaker_labels: nil
537
537
)
538
538
Kernel.warn("[DEPRECATION] `recognize_with_websocket` is deprecated and will be removed in the next major release. Please use `recognize_using_websocket` instead.")
0 commit comments