Skip to content

Commit 9c4315b

Browse files
committed
Add docs for 'result_index' usage and a system test.
1 parent e2921c7 commit 9c4315b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

docs/speech-usage.rst

Lines changed: 4 additions & 2 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
@@ -169,6 +169,8 @@ speech data to possible text alternatives on the fly.
169169
... encoding=speech.Encoding.LINEAR16,
170170
... sample_rate=16000)
171171
... results = list(sample.streaming_recognize())
172+
>>> print(results[0].result_index)
173+
0
172174
>>> print(results[0].alternatives[0].transcript)
173175
'hello'
174176
>>> print(results[0].alternatives[0].confidence)

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)