Skip to content

Commit 2db011c

Browse files
authored
Speech region tag update (GoogleCloudPlatform#1188)
1 parent b3ab36b commit 2db011c

File tree

2 files changed

+42
-30
lines changed

2 files changed

+42
-30
lines changed

speech/cloud-client/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
</properties>
3737

3838
<dependencies>
39-
<!-- [START dependencies] -->
39+
<!-- [START speech_quickstart_dependencies] -->
4040
<dependency>
4141
<groupId>com.google.cloud</groupId>
4242
<artifactId>google-cloud-speech</artifactId>
4343
<version>0.56.0-beta</version>
4444
</dependency>
45-
<!-- [END dependencies] -->
45+
<!-- [END speech_quickstart_dependencies] -->
4646

4747
<!-- Test dependencies -->
4848
<dependency>

speech/cloud-client/src/main/java/com/example/speech/Recognize.java

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public static void main(String... args) throws Exception {
146146
}
147147
}
148148

149+
// [START speech_transcribe_sync]
149150
/**
150151
* Performs speech recognition on raw PCM audio and prints the transcription.
151152
*
@@ -178,6 +179,7 @@ public static void syncRecognizeFile(String fileName) throws Exception {
178179
}
179180
}
180181
}
182+
// [END speech_transcribe_sync]
181183

182184
/**
183185
* Performs sync recognize and prints word time offsets.
@@ -222,6 +224,7 @@ public static void syncRecognizeWords(String fileName) throws Exception {
222224
}
223225
}
224226

227+
// [START speech_transcribe_sync_gcs]
225228
/**
226229
* Performs speech recognition on remote FLAC file and prints the transcription.
227230
*
@@ -251,7 +254,9 @@ public static void syncRecognizeGcs(String gcsUri) throws Exception {
251254
}
252255
}
253256
}
257+
// [END speech_transcribe_sync_gcs]
254258

259+
// [START speech_transcribe_async]
255260
/**
256261
* Performs non-blocking speech recognition on raw PCM audio and prints the transcription. Note
257262
* that transcription is limited to 60 seconds audio.
@@ -294,7 +299,9 @@ public static void asyncRecognizeFile(String fileName) throws Exception {
294299
}
295300
}
296301
}
302+
// [END speech_transcribe_async]
297303

304+
// [START speech_transcribe_async_time_offsets_gcs]
298305
/**
299306
* Performs non-blocking speech recognition on remote FLAC file and prints the transcription as
300307
* well as word time offsets.
@@ -342,7 +349,9 @@ public static void asyncRecognizeWords(String gcsUri) throws Exception {
342349
}
343350
}
344351
}
352+
// [END speech_transcribe_async_time_offsets_gcs]
345353

354+
// [START speech_transcribe_async_gcs]
346355
/**
347356
* Performs non-blocking speech recognition on remote FLAC file and prints the transcription.
348357
*
@@ -379,7 +388,9 @@ public static void asyncRecognizeGcs(String gcsUri) throws Exception {
379388
}
380389
}
381390
}
391+
// [END speech_transcribe_async_gcs]
382392

393+
// [START speech_transcribe_streaming]
383394
/**
384395
* Performs streaming speech recognition on raw PCM audio data.
385396
*
@@ -464,8 +475,9 @@ public SettableFuture<List<T>> future() {
464475
}
465476
}
466477
}
478+
// [END speech_transcribe_streaming]
467479

468-
// [START speech_transcribe_model_selection]
480+
// [START speech_transcribe_model_selection_beta]
469481
/**
470482
* Performs transcription of the given audio file synchronously with the selected model.
471483
*
@@ -499,10 +511,10 @@ public static void transcribeModelSelection(String fileName) throws Exception {
499511
SpeechRecognitionAlternative alternative = result.getAlternativesList().get(0);
500512
System.out.printf("Transcript : %s\n", alternative.getTranscript());
501513
}
502-
// [END speech_transcribe_model_selection]
514+
// [END speech_transcribe_model_selection_beta]
503515
}
504516

505-
// [START speech_transcribe_model_selection_gcs]
517+
// [START speech_transcribe_model_selection_gcs_beta]
506518
/**
507519
* Performs transcription of the remote audio file asynchronously with the selected model.
508520
*
@@ -543,7 +555,7 @@ public static void transcribeModelSelectionGcs(String gcsUri) throws Exception {
543555
SpeechRecognitionAlternative alternative = result.getAlternativesList().get(0);
544556
System.out.printf("Transcript : %s\n", alternative.getTranscript());
545557
}
546-
// [END speech_transcribe_model_selection_gcs]
558+
// [END speech_transcribe_model_selection_gcs_beta]
547559
}
548560

549561
// [START speech_sync_recognize_punctuation]
@@ -586,7 +598,7 @@ public static void transcribeFileWithAutomaticPunctuation(String fileName) throw
586598
}
587599
// [END speech_sync_recognize_punctuation]
588600

589-
// [START speech_async_recognize_gcs_punctuation]
601+
// [START speech_transcribe_auto_punctuation_beta]
590602
/**
591603
* Performs transcription on remote FLAC file and prints the transcription.
592604
*
@@ -626,7 +638,7 @@ public static void transcribeGcsWithAutomaticPunctuation(String gcsUri) throws E
626638
System.out.printf("Transcript : %s\n", alternative.getTranscript());
627639
}
628640
}
629-
// [END speech_async_recognize_gcs_punctuation]
641+
// [END speech_transcribe_auto_punctuation_beta]
630642

631643
// [START speech_stream_recognize_punctuation]
632644
/**
@@ -717,7 +729,7 @@ public SettableFuture<List<T>> future() {
717729
}
718730
// [END speech_stream_recognize_punctuation]
719731

720-
// [START speech_streaming_mic_recognize]
732+
// [START speech_transcribe_streaming_mic]
721733
/** Performs microphone streaming speech recognition with a duration of 1 minute. */
722734
public static void streamingMicRecognize() throws Exception {
723735

@@ -806,9 +818,9 @@ public void onError(Throwable t) {
806818
}
807819
responseObserver.onComplete();
808820
}
809-
// [END speech_streaming_mic_recognize]
821+
// [END speech_transcribe_streaming_mic]
810822

811-
// [START speech_transcribe_file_with_enhanced_model]
823+
// [START speech_transcribe_enhanced_model_beta]
812824
/**
813825
* Transcribe the given audio file using an enhanced model.
814826
*
@@ -848,9 +860,9 @@ public static void transcribeFileWithEnhancedModel(String fileName) throws Excep
848860
}
849861
}
850862
}
851-
// [END speech_transcribe_file_with_enhanced_model]
863+
// [END speech_transcribe_enhanced_model_beta]
852864

853-
// [START speech_transcribe_file_with_metadata]
865+
// [START speech_transcribe_recognition_metadata_beta]
854866
/**
855867
* Transcribe the given audio file and include recognition metadata in the request.
856868
*
@@ -900,9 +912,9 @@ public static void transcribeFileWithMetadata(String fileName) throws Exception
900912
}
901913
}
902914
}
903-
// [END speech_transcribe_file_with_metadata]
915+
// [END speech_transcribe_recognition_metadata_beta]
904916

905-
// [START speech_transcribe_diarization]
917+
// [START speech_transcribe_diarization_beta]
906918
/**
907919
* Transcribe the given audio file using speaker diarization.
908920
*
@@ -945,9 +957,9 @@ public static void transcribeDiarization(String fileName) throws Exception {
945957
}
946958
}
947959
}
948-
// [END speech_transcribe_diarization]
960+
// [END speech_transcribe_diarization_beta]
949961

950-
// [START speech_transcribe_diarization_gcs]
962+
// [START speech_transcribe_diarization_gcs_beta]
951963
/**
952964
* Transcribe a remote audio file using speaker diarization.
953965
*
@@ -991,9 +1003,9 @@ public static void transcribeDiarizationGcs(String gcsUri) throws Exception {
9911003
}
9921004
}
9931005

994-
// [END speech_transcribe_diarization_gcs]
1006+
// [END speech_transcribe_diarization_gcs_beta]
9951007

996-
// [START speech_transcribe_multichannel]
1008+
// [START speech_transcribe_multichannel_beta]
9971009

9981010
/**
9991011
* Transcribe a local audio file with multi-channel recognition
@@ -1032,9 +1044,9 @@ public static void transcribeMultiChannel(String fileName) throws Exception {
10321044
}
10331045
}
10341046
}
1035-
// [END speech_transcribe_multichannel]
1047+
// [END speech_transcribe_multichannel_beta]
10361048

1037-
// [START speech_transcribe_multichannel_gcs]
1049+
// [START speech_transcribe_multichannel_gcs_beta]
10381050

10391051
/**
10401052
* Transcribe a remote audio file with multi-channel recognition
@@ -1079,9 +1091,9 @@ public static void transcribeMultiChannelGcs(String gcsUri) throws Exception {
10791091
}
10801092
}
10811093
}
1082-
// [END speech_transcribe_multichannel_gcs]
1094+
// [END speech_transcribe_multichannel_gcs_beta]
10831095

1084-
// [START speech_transcribe_multilang]
1096+
// [START speech_transcribe_multilanguage_beta]
10851097

10861098
/**
10871099
* Transcribe a local audio file with multi-language recognition
@@ -1121,9 +1133,9 @@ public static void transcribeMultiLanguage(String fileName) throws Exception {
11211133
}
11221134
}
11231135
}
1124-
// [END speech_transcribe_multilang]
1136+
// [END speech_transcribe_multilanguage_beta]
11251137

1126-
// [START speech_transcribe_multilang_gcs]
1138+
// [START speech_transcribe_multilanguage_gcs_beta]
11271139

11281140
/**
11291141
* Transcribe a remote audio file with multi-language recognition
@@ -1169,9 +1181,9 @@ public static void transcribeMultiLanguageGcs(String gcsUri) throws Exception {
11691181
}
11701182
}
11711183
}
1172-
// [END speech_transcribe_multilang_gcs]
1184+
// [END speech_transcribe_multilanguage_gcs_beta]
11731185

1174-
// [START speech_transcribe_word_level_confidence]
1186+
// [START speech_transcribe_word_level_confidence_beta]
11751187

11761188
/**
11771189
* Transcribe a local audio file with word level confidence
@@ -1208,9 +1220,9 @@ public static void transcribeWordLevelConfidence(String fileName) throws Excepti
12081220
}
12091221
}
12101222
}
1211-
// [END speech_transcribe_word_level_confidence]
1223+
// [END speech_transcribe_word_level_confidence_beta]
12121224

1213-
// [START speech_transcribe_word_level_confidence_gcs]
1225+
// [START speech_transcribe_word_level_confidence_gcs_beta]
12141226

12151227
/**
12161228
* Transcribe a remote audio file with word level confidence
@@ -1253,5 +1265,5 @@ public static void transcribeWordLevelConfidenceGcs(String gcsUri) throws Except
12531265
alternative.getWords(0).getWord(), alternative.getWords(0).getConfidence());
12541266
}
12551267
}
1256-
// [END speech_transcribe_word_level_confidence_gcs]
1268+
// [END speech_transcribe_word_level_confidence_gcs_beta]
12571269
}

0 commit comments

Comments
 (0)