From fe0875a54c826ddb22b37c7de8445ac879e60d6d Mon Sep 17 00:00:00 2001 From: Yu-Han Liu Date: Mon, 17 Jul 2017 09:03:31 -0700 Subject: [PATCH] use region tags [(#1022)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1022) --- .../google-cloud-python-speech/samples/snippets/transcribe.py | 4 ++++ .../samples/snippets/transcribe_async.py | 4 ++++ .../samples/snippets/transcribe_streaming.py | 2 ++ 3 files changed, 10 insertions(+) diff --git a/packages/google-cloud-python-speech/samples/snippets/transcribe.py b/packages/google-cloud-python-speech/samples/snippets/transcribe.py index 6bd74354765e..b808e5813c00 100644 --- a/packages/google-cloud-python-speech/samples/snippets/transcribe.py +++ b/packages/google-cloud-python-speech/samples/snippets/transcribe.py @@ -28,6 +28,7 @@ # [END import_libraries] +# [START def_transcribe_file] def transcribe_file(speech_file): """Transcribe the given audio file.""" from google.cloud import speech @@ -55,8 +56,10 @@ def transcribe_file(speech_file): for alternative in alternatives: print('Transcript: {}'.format(alternative.transcript)) # [END migration_sync_response] +# [END def_transcribe_file] +# [START def_transcribe_gcs] def transcribe_gcs(gcs_uri): """Transcribes the audio file specified by the gcs_uri.""" from google.cloud import speech @@ -77,6 +80,7 @@ def transcribe_gcs(gcs_uri): for alternative in alternatives: print('Transcript: {}'.format(alternative.transcript)) +# [END def_transcribe_gcs] if __name__ == '__main__': diff --git a/packages/google-cloud-python-speech/samples/snippets/transcribe_async.py b/packages/google-cloud-python-speech/samples/snippets/transcribe_async.py index 65215e90210d..9e5a416a5674 100644 --- a/packages/google-cloud-python-speech/samples/snippets/transcribe_async.py +++ b/packages/google-cloud-python-speech/samples/snippets/transcribe_async.py @@ -27,6 +27,7 @@ import time +# [START def_transcribe_file] def transcribe_file(speech_file): """Transcribe the given audio file asynchronously.""" from google.cloud import speech @@ -63,8 +64,10 @@ def transcribe_file(speech_file): print('Transcript: {}'.format(alternative.transcript)) print('Confidence: {}'.format(alternative.confidence)) # [END migration_async_response] +# [END def_transcribe_file] +# [START def_transcribe_gcs] def transcribe_gcs(gcs_uri): """Asynchronously transcribes the audio file specified by the gcs_uri.""" from google.cloud import speech @@ -93,6 +96,7 @@ def transcribe_gcs(gcs_uri): for alternative in alternatives: print('Transcript: {}'.format(alternative.transcript)) print('Confidence: {}'.format(alternative.confidence)) +# [END def_transcribe_gcs] if __name__ == '__main__': diff --git a/packages/google-cloud-python-speech/samples/snippets/transcribe_streaming.py b/packages/google-cloud-python-speech/samples/snippets/transcribe_streaming.py index 455a470fcd79..8b659cde42cc 100644 --- a/packages/google-cloud-python-speech/samples/snippets/transcribe_streaming.py +++ b/packages/google-cloud-python-speech/samples/snippets/transcribe_streaming.py @@ -26,6 +26,7 @@ # [END import_libraries] +# [START def_transcribe_streaming] def transcribe_streaming(stream_file): """Streams transcription of the given audio file.""" from google.cloud import speech @@ -62,6 +63,7 @@ def transcribe_streaming(stream_file): print('Confidence: {}'.format(alternative.confidence)) print('Transcript: {}'.format(alternative.transcript)) # [END migration_streaming_response] +# [END def_transcribe_streaming] if __name__ == '__main__':