@@ -146,6 +146,7 @@ public static void main(String... args) throws Exception {
146
146
}
147
147
}
148
148
149
+ // [START speech_transcribe_sync]
149
150
/**
150
151
* Performs speech recognition on raw PCM audio and prints the transcription.
151
152
*
@@ -178,6 +179,7 @@ public static void syncRecognizeFile(String fileName) throws Exception {
178
179
}
179
180
}
180
181
}
182
+ // [END speech_transcribe_sync]
181
183
182
184
/**
183
185
* Performs sync recognize and prints word time offsets.
@@ -222,6 +224,7 @@ public static void syncRecognizeWords(String fileName) throws Exception {
222
224
}
223
225
}
224
226
227
+ // [START speech_transcribe_sync_gcs]
225
228
/**
226
229
* Performs speech recognition on remote FLAC file and prints the transcription.
227
230
*
@@ -251,7 +254,9 @@ public static void syncRecognizeGcs(String gcsUri) throws Exception {
251
254
}
252
255
}
253
256
}
257
+ // [END speech_transcribe_sync_gcs]
254
258
259
+ // [START speech_transcribe_async]
255
260
/**
256
261
* Performs non-blocking speech recognition on raw PCM audio and prints the transcription. Note
257
262
* that transcription is limited to 60 seconds audio.
@@ -294,7 +299,9 @@ public static void asyncRecognizeFile(String fileName) throws Exception {
294
299
}
295
300
}
296
301
}
302
+ // [END speech_transcribe_async]
297
303
304
+ // [START speech_transcribe_async_time_offsets_gcs]
298
305
/**
299
306
* Performs non-blocking speech recognition on remote FLAC file and prints the transcription as
300
307
* well as word time offsets.
@@ -342,7 +349,9 @@ public static void asyncRecognizeWords(String gcsUri) throws Exception {
342
349
}
343
350
}
344
351
}
352
+ // [END speech_transcribe_async_time_offsets_gcs]
345
353
354
+ // [START speech_transcribe_async_gcs]
346
355
/**
347
356
* Performs non-blocking speech recognition on remote FLAC file and prints the transcription.
348
357
*
@@ -379,7 +388,9 @@ public static void asyncRecognizeGcs(String gcsUri) throws Exception {
379
388
}
380
389
}
381
390
}
391
+ // [END speech_transcribe_async_gcs]
382
392
393
+ // [START speech_transcribe_streaming]
383
394
/**
384
395
* Performs streaming speech recognition on raw PCM audio data.
385
396
*
@@ -464,8 +475,9 @@ public SettableFuture<List<T>> future() {
464
475
}
465
476
}
466
477
}
478
+ // [END speech_transcribe_streaming]
467
479
468
- // [START speech_transcribe_model_selection ]
480
+ // [START speech_transcribe_model_selection_beta ]
469
481
/**
470
482
* Performs transcription of the given audio file synchronously with the selected model.
471
483
*
@@ -499,10 +511,10 @@ public static void transcribeModelSelection(String fileName) throws Exception {
499
511
SpeechRecognitionAlternative alternative = result .getAlternativesList ().get (0 );
500
512
System .out .printf ("Transcript : %s\n " , alternative .getTranscript ());
501
513
}
502
- // [END speech_transcribe_model_selection ]
514
+ // [END speech_transcribe_model_selection_beta ]
503
515
}
504
516
505
- // [START speech_transcribe_model_selection_gcs ]
517
+ // [START speech_transcribe_model_selection_gcs_beta ]
506
518
/**
507
519
* Performs transcription of the remote audio file asynchronously with the selected model.
508
520
*
@@ -543,7 +555,7 @@ public static void transcribeModelSelectionGcs(String gcsUri) throws Exception {
543
555
SpeechRecognitionAlternative alternative = result .getAlternativesList ().get (0 );
544
556
System .out .printf ("Transcript : %s\n " , alternative .getTranscript ());
545
557
}
546
- // [END speech_transcribe_model_selection_gcs ]
558
+ // [END speech_transcribe_model_selection_gcs_beta ]
547
559
}
548
560
549
561
// [START speech_sync_recognize_punctuation]
@@ -586,7 +598,7 @@ public static void transcribeFileWithAutomaticPunctuation(String fileName) throw
586
598
}
587
599
// [END speech_sync_recognize_punctuation]
588
600
589
- // [START speech_async_recognize_gcs_punctuation ]
601
+ // [START speech_transcribe_auto_punctuation_beta ]
590
602
/**
591
603
* Performs transcription on remote FLAC file and prints the transcription.
592
604
*
@@ -626,7 +638,7 @@ public static void transcribeGcsWithAutomaticPunctuation(String gcsUri) throws E
626
638
System .out .printf ("Transcript : %s\n " , alternative .getTranscript ());
627
639
}
628
640
}
629
- // [END speech_async_recognize_gcs_punctuation ]
641
+ // [END speech_transcribe_auto_punctuation_beta ]
630
642
631
643
// [START speech_stream_recognize_punctuation]
632
644
/**
@@ -717,7 +729,7 @@ public SettableFuture<List<T>> future() {
717
729
}
718
730
// [END speech_stream_recognize_punctuation]
719
731
720
- // [START speech_streaming_mic_recognize ]
732
+ // [START speech_transcribe_streaming_mic ]
721
733
/** Performs microphone streaming speech recognition with a duration of 1 minute. */
722
734
public static void streamingMicRecognize () throws Exception {
723
735
@@ -806,9 +818,9 @@ public void onError(Throwable t) {
806
818
}
807
819
responseObserver .onComplete ();
808
820
}
809
- // [END speech_streaming_mic_recognize ]
821
+ // [END speech_transcribe_streaming_mic ]
810
822
811
- // [START speech_transcribe_file_with_enhanced_model ]
823
+ // [START speech_transcribe_enhanced_model_beta ]
812
824
/**
813
825
* Transcribe the given audio file using an enhanced model.
814
826
*
@@ -848,9 +860,9 @@ public static void transcribeFileWithEnhancedModel(String fileName) throws Excep
848
860
}
849
861
}
850
862
}
851
- // [END speech_transcribe_file_with_enhanced_model ]
863
+ // [END speech_transcribe_enhanced_model_beta ]
852
864
853
- // [START speech_transcribe_file_with_metadata ]
865
+ // [START speech_transcribe_recognition_metadata_beta ]
854
866
/**
855
867
* Transcribe the given audio file and include recognition metadata in the request.
856
868
*
@@ -900,9 +912,9 @@ public static void transcribeFileWithMetadata(String fileName) throws Exception
900
912
}
901
913
}
902
914
}
903
- // [END speech_transcribe_file_with_metadata ]
915
+ // [END speech_transcribe_recognition_metadata_beta ]
904
916
905
- // [START speech_transcribe_diarization ]
917
+ // [START speech_transcribe_diarization_beta ]
906
918
/**
907
919
* Transcribe the given audio file using speaker diarization.
908
920
*
@@ -945,9 +957,9 @@ public static void transcribeDiarization(String fileName) throws Exception {
945
957
}
946
958
}
947
959
}
948
- // [END speech_transcribe_diarization ]
960
+ // [END speech_transcribe_diarization_beta ]
949
961
950
- // [START speech_transcribe_diarization_gcs ]
962
+ // [START speech_transcribe_diarization_gcs_beta ]
951
963
/**
952
964
* Transcribe a remote audio file using speaker diarization.
953
965
*
@@ -991,9 +1003,9 @@ public static void transcribeDiarizationGcs(String gcsUri) throws Exception {
991
1003
}
992
1004
}
993
1005
994
- // [END speech_transcribe_diarization_gcs ]
1006
+ // [END speech_transcribe_diarization_gcs_beta ]
995
1007
996
- // [START speech_transcribe_multichannel ]
1008
+ // [START speech_transcribe_multichannel_beta ]
997
1009
998
1010
/**
999
1011
* Transcribe a local audio file with multi-channel recognition
@@ -1032,9 +1044,9 @@ public static void transcribeMultiChannel(String fileName) throws Exception {
1032
1044
}
1033
1045
}
1034
1046
}
1035
- // [END speech_transcribe_multichannel ]
1047
+ // [END speech_transcribe_multichannel_beta ]
1036
1048
1037
- // [START speech_transcribe_multichannel_gcs ]
1049
+ // [START speech_transcribe_multichannel_gcs_beta ]
1038
1050
1039
1051
/**
1040
1052
* Transcribe a remote audio file with multi-channel recognition
@@ -1079,9 +1091,9 @@ public static void transcribeMultiChannelGcs(String gcsUri) throws Exception {
1079
1091
}
1080
1092
}
1081
1093
}
1082
- // [END speech_transcribe_multichannel_gcs ]
1094
+ // [END speech_transcribe_multichannel_gcs_beta ]
1083
1095
1084
- // [START speech_transcribe_multilang ]
1096
+ // [START speech_transcribe_multilanguage_beta ]
1085
1097
1086
1098
/**
1087
1099
* Transcribe a local audio file with multi-language recognition
@@ -1121,9 +1133,9 @@ public static void transcribeMultiLanguage(String fileName) throws Exception {
1121
1133
}
1122
1134
}
1123
1135
}
1124
- // [END speech_transcribe_multilang ]
1136
+ // [END speech_transcribe_multilanguage_beta ]
1125
1137
1126
- // [START speech_transcribe_multilang_gcs ]
1138
+ // [START speech_transcribe_multilanguage_gcs_beta ]
1127
1139
1128
1140
/**
1129
1141
* Transcribe a remote audio file with multi-language recognition
@@ -1169,9 +1181,9 @@ public static void transcribeMultiLanguageGcs(String gcsUri) throws Exception {
1169
1181
}
1170
1182
}
1171
1183
}
1172
- // [END speech_transcribe_multilang_gcs ]
1184
+ // [END speech_transcribe_multilanguage_gcs_beta ]
1173
1185
1174
- // [START speech_transcribe_word_level_confidence ]
1186
+ // [START speech_transcribe_word_level_confidence_beta ]
1175
1187
1176
1188
/**
1177
1189
* Transcribe a local audio file with word level confidence
@@ -1208,9 +1220,9 @@ public static void transcribeWordLevelConfidence(String fileName) throws Excepti
1208
1220
}
1209
1221
}
1210
1222
}
1211
- // [END speech_transcribe_word_level_confidence ]
1223
+ // [END speech_transcribe_word_level_confidence_beta ]
1212
1224
1213
- // [START speech_transcribe_word_level_confidence_gcs ]
1225
+ // [START speech_transcribe_word_level_confidence_gcs_beta ]
1214
1226
1215
1227
/**
1216
1228
* Transcribe a remote audio file with word level confidence
@@ -1253,5 +1265,5 @@ public static void transcribeWordLevelConfidenceGcs(String gcsUri) throws Except
1253
1265
alternative .getWords (0 ).getWord (), alternative .getWords (0 ).getConfidence ());
1254
1266
}
1255
1267
}
1256
- // [END speech_transcribe_word_level_confidence_gcs ]
1268
+ // [END speech_transcribe_word_level_confidence_gcs_beta ]
1257
1269
}
0 commit comments