Skip to content

Commit e7e323b

Browse files
committed
feat(STT):recognize_using_websocket contains new params processing_metrics, processing_metrics_interval and audio_metrics
1 parent 632ef78 commit e7e323b

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

ibm_watson/speech_to_text_v1_adapter.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ def recognize_using_websocket(self,
5050
customization_id=None,
5151
grammar_name=None,
5252
redaction=None,
53+
processing_metrics=None,
54+
processing_metrics_interval=None,
55+
audio_metrics=None,
5356
**kwargs):
5457
"""
5558
Sends audio for speech recognition using web sockets.
@@ -170,6 +173,23 @@ def recognize_using_websocket(self,
170173
**Note:** Applies to US English, Japanese, and Korean transcription only.
171174
See [Numeric
172175
redaction](https://cloud.ibm.com/docs/services/speech-to-text/output.html#redaction).
176+
:param bool processing_metrics: If `true`, requests processing metrics about the
177+
service's transcription of the input audio. The service returns processing metrics
178+
at the interval specified by the `processing_metrics_interval` parameter. It also
179+
returns processing metrics for transcription events, for example, for final and
180+
interim results. By default, the service returns no processing metrics.
181+
:param float processing_metrics_interval: Specifies the interval in real
182+
wall-clock seconds at which the service is to return processing metrics. The
183+
parameter is ignored unless the `processing_metrics` parameter is set to `true`.
184+
The parameter accepts a minimum value of 0.1 seconds. The level of precision is
185+
not restricted, so you can specify values such as 0.25 and 0.125.
186+
The service does not impose a maximum value. If you want to receive processing
187+
metrics only for transcription events instead of at periodic intervals, set the
188+
value to a large number. If the value is larger than the duration of the audio,
189+
the service returns processing metrics only for transcription events.
190+
:param bool audio_metrics: If `true`, requests detailed information about the
191+
signal characteristics of the input audio. The service returns audio metrics with
192+
the final transcription results. By default, the service returns no audio metrics.
173193
:param dict headers: A `dict` containing the request headers
174194
:return: A `dict` containing the `SpeechRecognitionResults` response.
175195
:rtype: dict
@@ -227,7 +247,10 @@ def recognize_using_websocket(self,
227247
'smart_formatting': smart_formatting,
228248
'speaker_labels': speaker_labels,
229249
'grammar_name': grammar_name,
230-
'redaction': redaction
250+
'redaction': redaction,
251+
'processing_metrics': processing_metrics,
252+
'processing_metrics_interval': processing_metrics_interval,
253+
'audio_metrics': audio_metrics
231254
}
232255
options = dict([(k, v) for k, v in options.items() if v is not None])
233256

0 commit comments

Comments
 (0)