From 09e1c63c373f82fd0bc96fcf0834abeed028e3b1 Mon Sep 17 00:00:00 2001 From: Gus Class Date: Fri, 3 Feb 2017 14:17:19 -0800 Subject: [PATCH] Adds usage examples to api-client samples and fixes copy/paste error in cloud-client/transcribe. --- speech/api-client/README.rst | 10 ++++++++++ speech/api-client/transcribe.py | 9 +++++++-- speech/api-client/transcribe_async.py | 9 +++++++-- speech/cloud-client/README.rst | 2 +- speech/cloud-client/transcribe.py | 2 +- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/speech/api-client/README.rst b/speech/api-client/README.rst index 45e74ac3dc5..12e1dc1d186 100644 --- a/speech/api-client/README.rst +++ b/speech/api-client/README.rst @@ -83,6 +83,11 @@ To run this sample: usage: transcribe.py [-h] speech_file + Google Cloud Speech API sample application using the REST API for batch + processing. + + Example usage: python transcribe.py resources/audio.raw + positional arguments: speech_file Full path of audio file to be recognized @@ -103,6 +108,11 @@ To run this sample: usage: transcribe_async.py [-h] speech_file + Google Cloud Speech API sample application using the REST API for async + batch processing. + + Example usage: python transcribe.py resources/audio.raw + positional arguments: speech_file Full path of audio file to be recognized diff --git a/speech/api-client/transcribe.py b/speech/api-client/transcribe.py index b5ad7e215d1..86aab42478f 100644 --- a/speech/api-client/transcribe.py +++ b/speech/api-client/transcribe.py @@ -13,7 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. """Google Cloud Speech API sample application using the REST API for batch -processing.""" +processing. + +Example usage: python transcribe.py resources/audio.raw +""" # [START import_libraries] import argparse @@ -89,7 +92,9 @@ def main(speech_file): # [START run_application] if __name__ == '__main__': - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser( + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument( 'speech_file', help='Full path of audio file to be recognized') args = parser.parse_args() diff --git a/speech/api-client/transcribe_async.py b/speech/api-client/transcribe_async.py index 27a0ef7bf8f..d9942b44fb9 100644 --- a/speech/api-client/transcribe_async.py +++ b/speech/api-client/transcribe_async.py @@ -13,7 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. """Google Cloud Speech API sample application using the REST API for async -batch processing.""" +batch processing. + +Example usage: python transcribe.py resources/audio.raw +""" # [START import_libraries] import argparse @@ -101,7 +104,9 @@ def main(speech_file): # [START run_application] if __name__ == '__main__': - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser( + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument( 'speech_file', help='Full path of audio file to be recognized') args = parser.parse_args() diff --git a/speech/cloud-client/README.rst b/speech/cloud-client/README.rst index ba9710e1c36..cd798d24946 100644 --- a/speech/cloud-client/README.rst +++ b/speech/cloud-client/README.rst @@ -98,7 +98,7 @@ To run this sample: Google Cloud Speech API sample application using the REST API for batch processing. - Example usage: python translate.py resources/audio.raw + Example usage: python transcribe.py resources/audio.raw positional arguments: speech_file Full path of audio file to be recognized diff --git a/speech/cloud-client/transcribe.py b/speech/cloud-client/transcribe.py index 5d7b0717f30..829cec5dd5d 100644 --- a/speech/cloud-client/transcribe.py +++ b/speech/cloud-client/transcribe.py @@ -17,7 +17,7 @@ """Google Cloud Speech API sample application using the REST API for batch processing. -Example usage: python translate.py resources/audio.raw +Example usage: python transcribe.py resources/audio.raw """ # [START import_libraries]