resource.proto 7.0 KB

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