Skip to content

Commit 5f43971

Browse files
committed
feat(websockets): Deprecate recognize_with_websocket in favor of recognize_using_websocket
1 parent 9898ba1 commit 5f43971

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

lib/ibm_watson/speech_to_text_v1.rb

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ def recognize(audio:, content_type:, model: nil, customization_id: nil, acoustic
425425
end
426426

427427
##
428-
# @!method recognize_with_websocket(audio: nil,chunk_data: false,content_type: "audio/l16; rate=44100",model: "en-US_BroadbandModel",recognize_callback: nil,customization_id: nil,acoustic_customization_id: nil,customization_weight: nil,version: nil,inactivity_timeout: 30,interim_results: false,keywords: nil,keywords_threshold: nil,max_alternatives: 1,word_alternatives_threshold: nil,word_confidence: false,timestamps: false,profanity_filter: nil,smart_formatting: false,speaker_labels: nil)
428+
# @!method recognize_using_websocket(audio: nil,chunk_data: false,content_type: "audio/l16; rate=44100",model: "en-US_BroadbandModel",recognize_callback: nil,customization_id: nil,acoustic_customization_id: nil,customization_weight: nil,version: nil,inactivity_timeout: 30,interim_results: false,keywords: nil,keywords_threshold: nil,max_alternatives: 1,word_alternatives_threshold: nil,word_confidence: false,timestamps: false,profanity_filter: nil,smart_formatting: false,speaker_labels: nil)
429429
# Sends audio for speech recognition using web sockets.
430430
# @param audio [IO] Audio to transcribe in the format specified by the `Content-Type` header.
431431
# @param chunk_data [Boolean] If true, then the WebSocketClient will expect to receive data in chunks rather than as a single audio file
@@ -448,7 +448,7 @@ def recognize(audio:, content_type:, model: nil, customization_id: nil, acoustic
448448
# @param smart_formatting [Boolean] If `true`, converts dates, times, series of digits and numbers, phone numbers, currency values, and Internet addresses into more readable, conventional representations in the final transcript of a recognition request. If `false` (the default), no formatting is performed. Applies to US English transcription only.
449449
# @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).
450450
# @return [WebSocketClient] Returns a new WebSocketClient object
451-
def recognize_with_websocket(
451+
def recognize_using_websocket(
452452
audio: nil,
453453
chunk_data: false,
454454
content_type: "audio/l16; rate=44100",
@@ -509,6 +509,56 @@ def recognize_with_websocket(
509509
options.delete_if { |_, v| v.nil? }
510510
WebSocketClient.new(audio: audio, chunk_data: chunk_data, options: options, recognize_callback: recognize_callback, url: url, headers: headers)
511511
end
512+
513+
# :nocov:
514+
# @deprecated This will method be removed in the next major release. Use {#recognize_using_websocket} instead.
515+
def recognize_with_websocket(
516+
audio: nil,
517+
chunk_data: false,
518+
content_type: "audio/l16; rate=44100",
519+
model: "en-US_BroadbandModel",
520+
recognize_callback: nil,
521+
customization_id: nil,
522+
acoustic_customization_id: nil,
523+
customization_weight: nil,
524+
version: nil,
525+
inactivity_timeout: 30,
526+
interim_results: false,
527+
keywords: nil,
528+
keywords_threshold: nil,
529+
max_alternatives: 1,
530+
word_alternatives_threshold: nil,
531+
word_confidence: false,
532+
timestamps: false,
533+
profanity_filter: nil,
534+
smart_formatting: false,
535+
speaker_labels: nil
536+
)
537+
Kernel.warn("[DEPRECATION] `recognize_with_websocket` is deprecated and will be removed in the next major release. Please use `recognize_using_websocket` instead.")
538+
recognize_using_websocket(
539+
audio: audio,
540+
chunk_data: chunk_data,
541+
content_type: content_type,
542+
model: model,
543+
recognize_callback: recognize_callback,
544+
customization_id: customization_id,
545+
acoustic_customization_id: acoustic_customization_id,
546+
customization_weight: customization_weight,
547+
version: version,
548+
inactivity_timeout: inactivity_timeout,
549+
interim_results: interim_results,
550+
keywords: keywords,
551+
keywords_threshold: keywords_threshold,
552+
max_alternatives: max_alternatives,
553+
word_alternatives_threshold: word_alternatives_threshold,
554+
word_confidence: word_confidence,
555+
timestamps: timestamps,
556+
profanity_filter: profanity_filter,
557+
smart_formatting: smart_formatting,
558+
speaker_labels: speaker_labels
559+
)
560+
end
561+
# :nocov:
512562
#########################
513563
# Asynchronous
514564
#########################

0 commit comments

Comments
 (0)