Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for 'result_index' usage and a system test. #3241

Merged
merged 1 commit into from
Mar 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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