33
33
34
34
def transcribe_file_with_enhanced_model ():
35
35
"""Transcribe the given audio file using an enhanced model."""
36
- # [START speech_transcribe_file_with_enhanced_model ]
36
+ # [START speech_transcribe_enhanced_model_beta ]
37
37
from google .cloud import speech_v1p1beta1 as speech
38
38
client = speech .SpeechClient ()
39
39
@@ -60,12 +60,12 @@ def transcribe_file_with_enhanced_model():
60
60
print ('-' * 20 )
61
61
print ('First alternative of result {}' .format (i ))
62
62
print ('Transcript: {}' .format (alternative .transcript ))
63
- # [END speech_transcribe_file_with_enhanced_model ]
63
+ # [END speech_transcribe_enhanced_model_beta ]
64
64
65
65
66
66
def transcribe_file_with_metadata ():
67
67
"""Send a request that includes recognition metadata."""
68
- # [START speech_transcribe_file_with_metadata ]
68
+ # [START speech_transcribe_recognition_metadata_beta ]
69
69
from google .cloud import speech_v1p1beta1 as speech
70
70
client = speech .SpeechClient ()
71
71
@@ -105,12 +105,12 @@ def transcribe_file_with_metadata():
105
105
print ('-' * 20 )
106
106
print ('First alternative of result {}' .format (i ))
107
107
print ('Transcript: {}' .format (alternative .transcript ))
108
- # [END speech_transcribe_file_with_metadata ]
108
+ # [END speech_transcribe_recognition_metadata_beta ]
109
109
110
110
111
111
def transcribe_file_with_auto_punctuation ():
112
112
"""Transcribe the given audio file with auto punctuation enabled."""
113
- # [START speech_transcribe_file_with_auto_punctuation ]
113
+ # [START speech_transcribe_auto_punctuation_beta ]
114
114
from google .cloud import speech_v1p1beta1 as speech
115
115
client = speech .SpeechClient ()
116
116
@@ -134,12 +134,12 @@ def transcribe_file_with_auto_punctuation():
134
134
print ('-' * 20 )
135
135
print ('First alternative of result {}' .format (i ))
136
136
print ('Transcript: {}' .format (alternative .transcript ))
137
- # [END speech_transcribe_file_with_auto_punctuation ]
137
+ # [END speech_transcribe_auto_punctuation_beta ]
138
138
139
139
140
140
def transcribe_file_with_diarization ():
141
141
"""Transcribe the given audio file synchronously with diarization."""
142
- # [START speech_transcribe_diarization ]
142
+ # [START speech_transcribe_diarization_beta ]
143
143
from google .cloud import speech_v1p1beta1 as speech
144
144
client = speech .SpeechClient ()
145
145
@@ -172,13 +172,13 @@ def transcribe_file_with_diarization():
172
172
for word_info in words_info :
173
173
print ("word: '{}', speaker_tag: {}" .format (word_info .word ,
174
174
word_info .speaker_tag ))
175
- # [END speech_transcribe_diarization ]
175
+ # [END speech_transcribe_diarization_beta ]
176
176
177
177
178
178
def transcribe_file_with_multichannel ():
179
179
"""Transcribe the given audio file synchronously with
180
180
multi channel."""
181
- # [START speech_transcribe_multichannel ]
181
+ # [START speech_transcribe_multichannel_beta ]
182
182
from google .cloud import speech_v1p1beta1 as speech
183
183
client = speech .SpeechClient ()
184
184
@@ -204,13 +204,13 @@ def transcribe_file_with_multichannel():
204
204
print ('First alternative of result {}' .format (i ))
205
205
print (u'Transcript: {}' .format (alternative .transcript ))
206
206
print (u'Channel Tag: {}' .format (result .channel_tag ))
207
- # [END speech_transcribe_multichannel ]
207
+ # [END speech_transcribe_multichannel_beta ]
208
208
209
209
210
210
def transcribe_file_with_multilanguage ():
211
211
"""Transcribe the given audio file synchronously with
212
212
multi language."""
213
- # [START speech_transcribe_multilanguage ]
213
+ # [START speech_transcribe_multilanguage_beta ]
214
214
from google .cloud import speech_v1p1beta1 as speech
215
215
client = speech .SpeechClient ()
216
216
@@ -238,13 +238,13 @@ def transcribe_file_with_multilanguage():
238
238
print ('-' * 20 )
239
239
print ('First alternative of result {}: {}' .format (i , alternative ))
240
240
print (u'Transcript: {}' .format (alternative .transcript ))
241
- # [END speech_transcribe_multilanguage ]
241
+ # [END speech_transcribe_multilanguage_beta ]
242
242
243
243
244
244
def transcribe_file_with_word_level_confidence ():
245
245
"""Transcribe the given audio file synchronously with
246
246
word level confidence."""
247
- # [START speech_transcribe_word_level_confidence ]
247
+ # [START speech_transcribe_word_level_confidence_beta ]
248
248
from google .cloud import speech_v1p1beta1 as speech
249
249
client = speech .SpeechClient ()
250
250
@@ -270,7 +270,7 @@ def transcribe_file_with_word_level_confidence():
270
270
print (u'Transcript: {}' .format (alternative .transcript ))
271
271
print (u'First Word and Confidence: ({}, {})' .format (
272
272
alternative .words [0 ].word , alternative .words [0 ].confidence ))
273
- # [END speech_transcribe_word_level_confidence ]
273
+ # [END speech_transcribe_word_level_confidence_beta ]
274
274
275
275
276
276
if __name__ == '__main__' :
0 commit comments