From b5742aa160f604ec7cd81873ad24ac9aa75e548d Mon Sep 17 00:00:00 2001 From: daspecster Date: Thu, 30 Mar 2017 11:24:23 -0400 Subject: [PATCH] Add docs for 'result_index' usage and a system test. --- docs/speech-usage.rst | 6 +++--- speech/tests/system.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/speech-usage.rst b/docs/speech-usage.rst index 5cb998a182a1..35920681f8d6 100644 --- a/docs/speech-usage.rst +++ b/docs/speech-usage.rst @@ -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 @@ -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 diff --git a/speech/tests/system.py b/speech/tests/system.py index d900240de014..a008b251d08d 100644 --- a/speech/tests/system.py +++ b/speech/tests/system.py @@ -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):