resource.proto 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // Copyright 2021 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. import "google/api/annotations.proto";
  18. option cc_enable_arenas = true;
  19. option go_package = "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech";
  20. option java_multiple_files = true;
  21. option java_outer_classname = "SpeechResourceProto";
  22. option java_package = "com.google.cloud.speech.v1p1beta1";
  23. option objc_class_prefix = "GCS";
  24. // A set of words or phrases that represents a common concept likely to appear
  25. // in your audio, for example a list of passenger ship names. CustomClass items
  26. // can be substituted into placeholders that you set in PhraseSet phrases.
  27. message CustomClass {
  28. option (google.api.resource) = {
  29. type: "speech.googleapis.com/CustomClass"
  30. pattern: "projects/{project}/locations/{location}/customClasses/{custom_class}"
  31. };
  32. // An item of the class.
  33. message ClassItem {
  34. // The class item's value.
  35. string value = 1;
  36. }
  37. // The resource name of the custom class.
  38. string name = 1;
  39. // If this custom class is a resource, the custom_class_id is the resource id
  40. // of the CustomClass. Case sensitive.
  41. string custom_class_id = 2;
  42. // A collection of class items.
  43. repeated ClassItem items = 3;
  44. }
  45. // Provides "hints" to the speech recognizer to favor specific words and phrases
  46. // in the results.
  47. message PhraseSet {
  48. option (google.api.resource) = {
  49. type: "speech.googleapis.com/PhraseSet"
  50. pattern: "projects/{project}/locations/{location}/phraseSets/{phrase_set}"
  51. };
  52. // A phrases containing words and phrase "hints" so that
  53. // the speech recognition is more likely to recognize them. This can be used
  54. // to improve the accuracy for specific words and phrases, for example, if
  55. // specific commands are typically spoken by the user. This can also be used
  56. // to add additional words to the vocabulary of the recognizer. See
  57. // [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
  58. //
  59. // List items can also include pre-built or custom classes containing groups
  60. // of words that represent common concepts that occur in natural language. For
  61. // example, rather than providing a phrase hint for every month of the
  62. // year (e.g. "i was born in january", "i was born in febuary", ...), use the
  63. // pre-built `$MONTH` class improves the likelihood of correctly transcribing
  64. // audio that includes months (e.g. "i was born in $month").
  65. // To refer to pre-built classes, use the class' symbol prepended with `$`
  66. // e.g. `$MONTH`. To refer to custom classes that were defined inline in the
  67. // request, set the class's `custom_class_id` to a string unique to all class
  68. // resources and inline classes. Then use the class' id wrapped in $`{...}`
  69. // e.g. "${my-months}". To refer to custom classes resources, use the class'
  70. // id wrapped in `${}` (e.g. `${my-months}`).
  71. message Phrase {
  72. // The phrase itself.
  73. string value = 1;
  74. // Hint Boost. Overrides the boost set at the phrase set level.
  75. // Positive value will increase the probability that a specific phrase will
  76. // be recognized over other similar sounding phrases. The higher the boost,
  77. // the higher the chance of false positive recognition as well. Negative
  78. // boost values would correspond to anti-biasing. Anti-biasing is not
  79. // enabled, so negative boost will simply be ignored. Though `boost` can
  80. // accept a wide range of positive values, most use cases are best served
  81. // with values between 0 and 20. We recommend using a binary search approach
  82. // to finding the optimal value for your use case. Speech recognition
  83. // will skip PhraseSets with a boost value of 0.
  84. float boost = 2;
  85. }
  86. // The resource name of the phrase set.
  87. string name = 1;
  88. // A list of word and phrases.
  89. repeated Phrase phrases = 2;
  90. // Hint Boost. Positive value will increase the probability that a specific
  91. // phrase will be recognized over other similar sounding phrases. The higher
  92. // the boost, the higher the chance of false positive recognition as well.
  93. // Negative boost values would correspond to anti-biasing. Anti-biasing is not
  94. // enabled, so negative boost will simply be ignored. Though `boost` can
  95. // accept a wide range of positive values, most use cases are best served with
  96. // values between 0 (exclusive) and 20. We recommend using a binary search
  97. // approach to finding the optimal value for your use case. Speech recognition
  98. // will skip PhraseSets with a boost value of 0.
  99. float boost = 4;
  100. }
  101. // Speech adaptation configuration.
  102. message SpeechAdaptation {
  103. // A collection of phrase sets. To specify the hints inline, leave the
  104. // phrase set's `name` blank and fill in the rest of its fields. Any
  105. // phrase set can use any custom class.
  106. repeated PhraseSet phrase_sets = 1;
  107. // A collection of phrase set resource names to use.
  108. repeated string phrase_set_references = 2 [(google.api.resource_reference) = {
  109. type: "speech.googleapis.com/PhraseSet"
  110. }];
  111. // A collection of custom classes. To specify the classes inline, leave the
  112. // class' `name` blank and fill in the rest of its fields, giving it a unique
  113. // `custom_class_id`. Refer to the inline defined class in phrase hints by its
  114. // `custom_class_id`.
  115. repeated CustomClass custom_classes = 3;
  116. }