From 818e39bc266421c59edcc31c093f9284c83a3c09 Mon Sep 17 00:00:00 2001 From: Torry Yang Date: Mon, 16 Apr 2018 15:06:37 -0700 Subject: [PATCH] use unicode [(#1453)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/1453) --- google-cloud-speech/samples/snippets/transcribe.py | 4 ++-- google-cloud-speech/samples/snippets/transcribe_async.py | 4 ++-- .../samples/snippets/transcribe_model_selection.py | 4 ++-- google-cloud-speech/samples/snippets/transcribe_streaming.py | 2 +- .../samples/snippets/transcribe_word_time_offsets.py | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/google-cloud-speech/samples/snippets/transcribe.py b/google-cloud-speech/samples/snippets/transcribe.py index 865cc5742704..8a47fb3b6ac8 100644 --- a/google-cloud-speech/samples/snippets/transcribe.py +++ b/google-cloud-speech/samples/snippets/transcribe.py @@ -55,7 +55,7 @@ def transcribe_file(speech_file): # them to get the transcripts for the entire audio file. for result in response.results: # The first alternative is the most likely one for this portion. - print('Transcript: {}'.format(result.alternatives[0].transcript)) + print(u'Transcript: {}'.format(result.alternatives[0].transcript)) # [END migration_sync_response] # [END def_transcribe_file] @@ -81,7 +81,7 @@ def transcribe_gcs(gcs_uri): # them to get the transcripts for the entire audio file. for result in response.results: # The first alternative is the most likely one for this portion. - print('Transcript: {}'.format(result.alternatives[0].transcript)) + print(u'Transcript: {}'.format(result.alternatives[0].transcript)) # [END def_transcribe_gcs] diff --git a/google-cloud-speech/samples/snippets/transcribe_async.py b/google-cloud-speech/samples/snippets/transcribe_async.py index 0b16dccbc889..0f1bb558535d 100644 --- a/google-cloud-speech/samples/snippets/transcribe_async.py +++ b/google-cloud-speech/samples/snippets/transcribe_async.py @@ -55,7 +55,7 @@ def transcribe_file(speech_file): # them to get the transcripts for the entire audio file. for result in response.results: # The first alternative is the most likely one for this portion. - print('Transcript: {}'.format(result.alternatives[0].transcript)) + print(u'Transcript: {}'.format(result.alternatives[0].transcript)) print('Confidence: {}'.format(result.alternatives[0].confidence)) # [END migration_async_response] # [END def_transcribe_file] @@ -84,7 +84,7 @@ def transcribe_gcs(gcs_uri): # them to get the transcripts for the entire audio file. for result in response.results: # The first alternative is the most likely one for this portion. - print('Transcript: {}'.format(result.alternatives[0].transcript)) + print(u'Transcript: {}'.format(result.alternatives[0].transcript)) print('Confidence: {}'.format(result.alternatives[0].confidence)) # [END def_transcribe_gcs] diff --git a/google-cloud-speech/samples/snippets/transcribe_model_selection.py b/google-cloud-speech/samples/snippets/transcribe_model_selection.py index bccad1817754..bc86bcad782e 100644 --- a/google-cloud-speech/samples/snippets/transcribe_model_selection.py +++ b/google-cloud-speech/samples/snippets/transcribe_model_selection.py @@ -51,7 +51,7 @@ def transcribe_model_selection(speech_file, model): alternative = result.alternatives[0] print('-' * 20) print('First alternative of result {}'.format(i)) - print('Transcript: {}'.format(alternative.transcript)) + print(u'Transcript: {}'.format(alternative.transcript)) # [END speech_transcribe_model_selection] @@ -79,7 +79,7 @@ def transcribe_model_selection_gcs(gcs_uri, model): alternative = result.alternatives[0] print('-' * 20) print('First alternative of result {}'.format(i)) - print('Transcript: {}'.format(alternative.transcript)) + print(u'Transcript: {}'.format(alternative.transcript)) # [END speech_transcribe_model_selection_gcs] diff --git a/google-cloud-speech/samples/snippets/transcribe_streaming.py b/google-cloud-speech/samples/snippets/transcribe_streaming.py index 6a322a9524c9..8c826fcf3981 100644 --- a/google-cloud-speech/samples/snippets/transcribe_streaming.py +++ b/google-cloud-speech/samples/snippets/transcribe_streaming.py @@ -65,7 +65,7 @@ def transcribe_streaming(stream_file): # The alternatives are ordered from most likely to least. for alternative in alternatives: print('Confidence: {}'.format(alternative.confidence)) - print('Transcript: {}'.format(alternative.transcript)) + print(u'Transcript: {}'.format(alternative.transcript)) # [END migration_streaming_response] # [END def_transcribe_streaming] diff --git a/google-cloud-speech/samples/snippets/transcribe_word_time_offsets.py b/google-cloud-speech/samples/snippets/transcribe_word_time_offsets.py index f576e58aed7a..2bd0d746d28b 100644 --- a/google-cloud-speech/samples/snippets/transcribe_word_time_offsets.py +++ b/google-cloud-speech/samples/snippets/transcribe_word_time_offsets.py @@ -48,7 +48,7 @@ def transcribe_file_with_word_time_offsets(speech_file): for result in response.results: alternative = result.alternatives[0] - print('Transcript: {}'.format(alternative.transcript)) + print(u'Transcript: {}'.format(alternative.transcript)) for word_info in alternative.words: word = word_info.word @@ -83,7 +83,7 @@ def transcribe_gcs_with_word_time_offsets(gcs_uri): for result in result.results: alternative = result.alternatives[0] - print('Transcript: {}'.format(alternative.transcript)) + print(u'Transcript: {}'.format(alternative.transcript)) print('Confidence: {}'.format(alternative.confidence)) for word_info in alternative.words: