1*d5c09012SAndroid Build Coastguard Worker// Copyright 2023 Google LLC 2*d5c09012SAndroid Build Coastguard Worker// 3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License"); 4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License. 5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at 6*d5c09012SAndroid Build Coastguard Worker// 7*d5c09012SAndroid Build Coastguard Worker// http://www.apache.org/licenses/LICENSE-2.0 8*d5c09012SAndroid Build Coastguard Worker// 9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software 10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS, 11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and 13*d5c09012SAndroid Build Coastguard Worker// limitations under the License. 14*d5c09012SAndroid Build Coastguard Worker 15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3"; 16*d5c09012SAndroid Build Coastguard Worker 17*d5c09012SAndroid Build Coastguard Workerpackage google.cloud.speech.v1; 18*d5c09012SAndroid Build Coastguard Worker 19*d5c09012SAndroid Build Coastguard Workerimport "google/api/resource.proto"; 20*d5c09012SAndroid Build Coastguard Worker 21*d5c09012SAndroid Build Coastguard Workeroption cc_enable_arenas = true; 22*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/speech/apiv1/speechpb;speechpb"; 23*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true; 24*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "SpeechResourceProto"; 25*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.cloud.speech.v1"; 26*d5c09012SAndroid Build Coastguard Workeroption objc_class_prefix = "GCS"; 27*d5c09012SAndroid Build Coastguard Worker 28*d5c09012SAndroid Build Coastguard Worker// A set of words or phrases that represents a common concept likely to appear 29*d5c09012SAndroid Build Coastguard Worker// in your audio, for example a list of passenger ship names. CustomClass items 30*d5c09012SAndroid Build Coastguard Worker// can be substituted into placeholders that you set in PhraseSet phrases. 31*d5c09012SAndroid Build Coastguard Workermessage CustomClass { 32*d5c09012SAndroid Build Coastguard Worker option (google.api.resource) = { 33*d5c09012SAndroid Build Coastguard Worker type: "speech.googleapis.com/CustomClass" 34*d5c09012SAndroid Build Coastguard Worker pattern: "projects/{project}/locations/{location}/customClasses/{custom_class}" 35*d5c09012SAndroid Build Coastguard Worker }; 36*d5c09012SAndroid Build Coastguard Worker 37*d5c09012SAndroid Build Coastguard Worker // An item of the class. 38*d5c09012SAndroid Build Coastguard Worker message ClassItem { 39*d5c09012SAndroid Build Coastguard Worker // The class item's value. 40*d5c09012SAndroid Build Coastguard Worker string value = 1; 41*d5c09012SAndroid Build Coastguard Worker } 42*d5c09012SAndroid Build Coastguard Worker 43*d5c09012SAndroid Build Coastguard Worker // The resource name of the custom class. 44*d5c09012SAndroid Build Coastguard Worker string name = 1; 45*d5c09012SAndroid Build Coastguard Worker 46*d5c09012SAndroid Build Coastguard Worker // If this custom class is a resource, the custom_class_id is the resource id 47*d5c09012SAndroid Build Coastguard Worker // of the CustomClass. Case sensitive. 48*d5c09012SAndroid Build Coastguard Worker string custom_class_id = 2; 49*d5c09012SAndroid Build Coastguard Worker 50*d5c09012SAndroid Build Coastguard Worker // A collection of class items. 51*d5c09012SAndroid Build Coastguard Worker repeated ClassItem items = 3; 52*d5c09012SAndroid Build Coastguard Worker} 53*d5c09012SAndroid Build Coastguard Worker 54*d5c09012SAndroid Build Coastguard Worker// Provides "hints" to the speech recognizer to favor specific words and phrases 55*d5c09012SAndroid Build Coastguard Worker// in the results. 56*d5c09012SAndroid Build Coastguard Workermessage PhraseSet { 57*d5c09012SAndroid Build Coastguard Worker option (google.api.resource) = { 58*d5c09012SAndroid Build Coastguard Worker type: "speech.googleapis.com/PhraseSet" 59*d5c09012SAndroid Build Coastguard Worker pattern: "projects/{project}/locations/{location}/phraseSets/{phrase_set}" 60*d5c09012SAndroid Build Coastguard Worker }; 61*d5c09012SAndroid Build Coastguard Worker 62*d5c09012SAndroid Build Coastguard Worker // A phrases containing words and phrase "hints" so that 63*d5c09012SAndroid Build Coastguard Worker // the speech recognition is more likely to recognize them. This can be used 64*d5c09012SAndroid Build Coastguard Worker // to improve the accuracy for specific words and phrases, for example, if 65*d5c09012SAndroid Build Coastguard Worker // specific commands are typically spoken by the user. This can also be used 66*d5c09012SAndroid Build Coastguard Worker // to add additional words to the vocabulary of the recognizer. See 67*d5c09012SAndroid Build Coastguard Worker // [usage limits](https://cloud.google.com/speech-to-text/quotas#content). 68*d5c09012SAndroid Build Coastguard Worker // 69*d5c09012SAndroid Build Coastguard Worker // List items can also include pre-built or custom classes containing groups 70*d5c09012SAndroid Build Coastguard Worker // of words that represent common concepts that occur in natural language. For 71*d5c09012SAndroid Build Coastguard Worker // example, rather than providing a phrase hint for every month of the 72*d5c09012SAndroid Build Coastguard Worker // year (e.g. "i was born in january", "i was born in febuary", ...), use the 73*d5c09012SAndroid Build Coastguard Worker // pre-built `$MONTH` class improves the likelihood of correctly transcribing 74*d5c09012SAndroid Build Coastguard Worker // audio that includes months (e.g. "i was born in $month"). 75*d5c09012SAndroid Build Coastguard Worker // To refer to pre-built classes, use the class' symbol prepended with `$` 76*d5c09012SAndroid Build Coastguard Worker // e.g. `$MONTH`. To refer to custom classes that were defined inline in the 77*d5c09012SAndroid Build Coastguard Worker // request, set the class's `custom_class_id` to a string unique to all class 78*d5c09012SAndroid Build Coastguard Worker // resources and inline classes. Then use the class' id wrapped in $`{...}` 79*d5c09012SAndroid Build Coastguard Worker // e.g. "${my-months}". To refer to custom classes resources, use the class' 80*d5c09012SAndroid Build Coastguard Worker // id wrapped in `${}` (e.g. `${my-months}`). 81*d5c09012SAndroid Build Coastguard Worker // 82*d5c09012SAndroid Build Coastguard Worker // Speech-to-Text supports three locations: `global`, `us` (US North America), 83*d5c09012SAndroid Build Coastguard Worker // and `eu` (Europe). If you are calling the `speech.googleapis.com` 84*d5c09012SAndroid Build Coastguard Worker // endpoint, use the `global` location. To specify a region, use a 85*d5c09012SAndroid Build Coastguard Worker // [regional endpoint](https://cloud.google.com/speech-to-text/docs/endpoints) 86*d5c09012SAndroid Build Coastguard Worker // with matching `us` or `eu` location value. 87*d5c09012SAndroid Build Coastguard Worker message Phrase { 88*d5c09012SAndroid Build Coastguard Worker // The phrase itself. 89*d5c09012SAndroid Build Coastguard Worker string value = 1; 90*d5c09012SAndroid Build Coastguard Worker 91*d5c09012SAndroid Build Coastguard Worker // Hint Boost. Overrides the boost set at the phrase set level. 92*d5c09012SAndroid Build Coastguard Worker // Positive value will increase the probability that a specific phrase will 93*d5c09012SAndroid Build Coastguard Worker // be recognized over other similar sounding phrases. The higher the boost, 94*d5c09012SAndroid Build Coastguard Worker // the higher the chance of false positive recognition as well. Negative 95*d5c09012SAndroid Build Coastguard Worker // boost will simply be ignored. Though `boost` can accept a wide range of 96*d5c09012SAndroid Build Coastguard Worker // positive values, most use cases are best served 97*d5c09012SAndroid Build Coastguard Worker // with values between 0 and 20. We recommend using a binary search approach 98*d5c09012SAndroid Build Coastguard Worker // to finding the optimal value for your use case as well as adding 99*d5c09012SAndroid Build Coastguard Worker // phrases both with and without boost to your requests. 100*d5c09012SAndroid Build Coastguard Worker float boost = 2; 101*d5c09012SAndroid Build Coastguard Worker } 102*d5c09012SAndroid Build Coastguard Worker 103*d5c09012SAndroid Build Coastguard Worker // The resource name of the phrase set. 104*d5c09012SAndroid Build Coastguard Worker string name = 1; 105*d5c09012SAndroid Build Coastguard Worker 106*d5c09012SAndroid Build Coastguard Worker // A list of word and phrases. 107*d5c09012SAndroid Build Coastguard Worker repeated Phrase phrases = 2; 108*d5c09012SAndroid Build Coastguard Worker 109*d5c09012SAndroid Build Coastguard Worker // Hint Boost. Positive value will increase the probability that a specific 110*d5c09012SAndroid Build Coastguard Worker // phrase will be recognized over other similar sounding phrases. The higher 111*d5c09012SAndroid Build Coastguard Worker // the boost, the higher the chance of false positive recognition as well. 112*d5c09012SAndroid Build Coastguard Worker // Negative boost values would correspond to anti-biasing. Anti-biasing is not 113*d5c09012SAndroid Build Coastguard Worker // enabled, so negative boost will simply be ignored. Though `boost` can 114*d5c09012SAndroid Build Coastguard Worker // accept a wide range of positive values, most use cases are best served with 115*d5c09012SAndroid Build Coastguard Worker // values between 0 (exclusive) and 20. We recommend using a binary search 116*d5c09012SAndroid Build Coastguard Worker // approach to finding the optimal value for your use case as well as adding 117*d5c09012SAndroid Build Coastguard Worker // phrases both with and without boost to your requests. 118*d5c09012SAndroid Build Coastguard Worker float boost = 4; 119*d5c09012SAndroid Build Coastguard Worker} 120*d5c09012SAndroid Build Coastguard Worker 121*d5c09012SAndroid Build Coastguard Worker// Speech adaptation configuration. 122*d5c09012SAndroid Build Coastguard Workermessage SpeechAdaptation { 123*d5c09012SAndroid Build Coastguard Worker message ABNFGrammar { 124*d5c09012SAndroid Build Coastguard Worker // All declarations and rules of an ABNF grammar broken up into multiple 125*d5c09012SAndroid Build Coastguard Worker // strings that will end up concatenated. 126*d5c09012SAndroid Build Coastguard Worker repeated string abnf_strings = 1; 127*d5c09012SAndroid Build Coastguard Worker } 128*d5c09012SAndroid Build Coastguard Worker 129*d5c09012SAndroid Build Coastguard Worker // A collection of phrase sets. To specify the hints inline, leave the 130*d5c09012SAndroid Build Coastguard Worker // phrase set's `name` blank and fill in the rest of its fields. Any 131*d5c09012SAndroid Build Coastguard Worker // phrase set can use any custom class. 132*d5c09012SAndroid Build Coastguard Worker repeated PhraseSet phrase_sets = 1; 133*d5c09012SAndroid Build Coastguard Worker 134*d5c09012SAndroid Build Coastguard Worker // A collection of phrase set resource names to use. 135*d5c09012SAndroid Build Coastguard Worker repeated string phrase_set_references = 2 [(google.api.resource_reference) = { 136*d5c09012SAndroid Build Coastguard Worker type: "speech.googleapis.com/PhraseSet" 137*d5c09012SAndroid Build Coastguard Worker }]; 138*d5c09012SAndroid Build Coastguard Worker 139*d5c09012SAndroid Build Coastguard Worker // A collection of custom classes. To specify the classes inline, leave the 140*d5c09012SAndroid Build Coastguard Worker // class' `name` blank and fill in the rest of its fields, giving it a unique 141*d5c09012SAndroid Build Coastguard Worker // `custom_class_id`. Refer to the inline defined class in phrase hints by its 142*d5c09012SAndroid Build Coastguard Worker // `custom_class_id`. 143*d5c09012SAndroid Build Coastguard Worker repeated CustomClass custom_classes = 3; 144*d5c09012SAndroid Build Coastguard Worker 145*d5c09012SAndroid Build Coastguard Worker // Augmented Backus-Naur form (ABNF) is a standardized grammar notation 146*d5c09012SAndroid Build Coastguard Worker // comprised by a set of derivation rules. 147*d5c09012SAndroid Build Coastguard Worker // See specifications: https://www.w3.org/TR/speech-grammar 148*d5c09012SAndroid Build Coastguard Worker ABNFGrammar abnf_grammar = 4; 149*d5c09012SAndroid Build Coastguard Worker} 150*d5c09012SAndroid Build Coastguard Worker 151*d5c09012SAndroid Build Coastguard Worker// Transcription normalization configuration. Use transcription normalization 152*d5c09012SAndroid Build Coastguard Worker// to automatically replace parts of the transcript with phrases of your 153*d5c09012SAndroid Build Coastguard Worker// choosing. For StreamingRecognize, this normalization only applies to stable 154*d5c09012SAndroid Build Coastguard Worker// partial transcripts (stability > 0.8) and final transcripts. 155*d5c09012SAndroid Build Coastguard Workermessage TranscriptNormalization { 156*d5c09012SAndroid Build Coastguard Worker // A single replacement configuration. 157*d5c09012SAndroid Build Coastguard Worker message Entry { 158*d5c09012SAndroid Build Coastguard Worker // What to replace. Max length is 100 characters. 159*d5c09012SAndroid Build Coastguard Worker string search = 1; 160*d5c09012SAndroid Build Coastguard Worker 161*d5c09012SAndroid Build Coastguard Worker // What to replace with. Max length is 100 characters. 162*d5c09012SAndroid Build Coastguard Worker string replace = 2; 163*d5c09012SAndroid Build Coastguard Worker 164*d5c09012SAndroid Build Coastguard Worker // Whether the search is case sensitive. 165*d5c09012SAndroid Build Coastguard Worker bool case_sensitive = 3; 166*d5c09012SAndroid Build Coastguard Worker } 167*d5c09012SAndroid Build Coastguard Worker 168*d5c09012SAndroid Build Coastguard Worker // A list of replacement entries. We will perform replacement with one entry 169*d5c09012SAndroid Build Coastguard Worker // at a time. For example, the second entry in ["cat" => "dog", "mountain cat" 170*d5c09012SAndroid Build Coastguard Worker // => "mountain dog"] will never be applied because we will always process the 171*d5c09012SAndroid Build Coastguard Worker // first entry before it. At most 100 entries. 172*d5c09012SAndroid Build Coastguard Worker repeated Entry entries = 1; 173*d5c09012SAndroid Build Coastguard Worker} 174