Skip to content

Commit

Permalink
Add docs for 'result_index' usage and a system test.
Browse files Browse the repository at this point in the history
  • Loading branch information
daspecster committed Mar 30, 2017
1 parent 2a0ba64 commit b5742aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/speech-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ create an instance of :class:`~google.cloud.speech.client.Client`.
>>> client = speech.Client()
Asychronous Recognition
-----------------------
Asynchronous Recognition
------------------------

The :meth:`~google.cloud.speech.Client.async_recognize` sends audio data to the
Speech API and initiates a Long Running Operation. Using this operation, you
Expand Down Expand Up @@ -170,13 +170,13 @@ speech data to possible text alternatives on the fly.
... for result in results:
... for alternative in result.alternatives:
... print('=' * 20)
... print('result_index: ' + str(result.result_index))
... print('transcript: ' + alternative.transcript)
... print('confidence: ' + str(alternative.confidence))
====================
transcript: hello thank you for using Google Cloud platform
confidence: 0.927983105183
By default the API will perform continuous recognition
(continuing to process audio even if the speaker in the audio pauses speaking)
until the client closes the output stream or until the maximum time limit has
Expand Down
1 change: 1 addition & 0 deletions speech/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def test_stream_recognize(self):

with open(AUDIO_FILE, 'rb') as file_obj:
for results in self._make_streaming_request(file_obj):
self.assertIsInstance(results.result_index, int)
self._check_results(results.alternatives)

def test_stream_recognize_interim_results(self):
Expand Down

0 comments on commit b5742aa

Please sign in to comment.