Skip to content

Commit 0aaf359

Browse files
authored
Merge pull request #3241 from daspecster/speech-add-result-index
Add docs for 'result_index' usage and a system test.
2 parents 0f12813 + b5742aa commit 0aaf359

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

docs/speech-usage.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ create an instance of :class:`~google.cloud.speech.client.Client`.
3131
>>> client = speech.Client()
3232
3333
34-
Asychronous Recognition
35-
-----------------------
34+
Asynchronous Recognition
35+
------------------------
3636

3737
The :meth:`~google.cloud.speech.Client.async_recognize` sends audio data to the
3838
Speech API and initiates a Long Running Operation. Using this operation, you
@@ -170,13 +170,13 @@ speech data to possible text alternatives on the fly.
170170
... for result in results:
171171
... for alternative in result.alternatives:
172172
... print('=' * 20)
173+
... print('result_index: ' + str(result.result_index))
173174
... print('transcript: ' + alternative.transcript)
174175
... print('confidence: ' + str(alternative.confidence))
175176
====================
176177
transcript: hello thank you for using Google Cloud platform
177178
confidence: 0.927983105183
178179
179-
180180
By default the API will perform continuous recognition
181181
(continuing to process audio even if the speaker in the audio pauses speaking)
182182
until the client closes the output stream or until the maximum time limit has

speech/tests/system.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ def test_stream_recognize(self):
200200

201201
with open(AUDIO_FILE, 'rb') as file_obj:
202202
for results in self._make_streaming_request(file_obj):
203+
self.assertIsInstance(results.result_index, int)
203204
self._check_results(results.alternatives)
204205

205206
def test_stream_recognize_interim_results(self):

0 commit comments

Comments
 (0)