blob: e743764c67fac4a66bb016777ecaddb4436aa46f [file] [log] [blame]
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -04001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070075<h1><a href="speech_v1.html">Cloud Speech-to-Text API</a> . <a href="speech_v1.speech.html">speech</a></h1>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040076<h2>Instance Methods</h2>
77<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070078 <code><a href="#longrunningrecognize">longrunningrecognize(body=None, x__xgafv=None)</a></code></p>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040079<p class="firstline">Performs asynchronous speech recognition: receive results via the</p>
80<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070081 <code><a href="#recognize">recognize(body=None, x__xgafv=None)</a></code></p>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040082<p class="firstline">Performs synchronous speech recognition: receive results after all audio</p>
83<h3>Method Details</h3>
84<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -070085 <code class="details" id="longrunningrecognize">longrunningrecognize(body=None, x__xgafv=None)</code>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040086 <pre>Performs asynchronous speech recognition: receive results via the
87google.longrunning.Operations interface. Returns either an
88`Operation.error` or an `Operation.response` which contains
89a `LongRunningRecognizeResponse` message.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070090For more information on asynchronous speech recognition, see the
91[how-to](https://cloud.google.com/speech-to-text/docs/async-recognize).
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040092
93Args:
Dan O'Mearadd494642020-05-01 07:42:23 -070094 body: object, The request body.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -040095 The object takes the form of:
96
97{ # The top-level message sent by the client for the `LongRunningRecognize`
98 # method.
Dan O'Mearadd494642020-05-01 07:42:23 -070099 "audio": { # Contains audio data in the encoding specified in the `RecognitionConfig`. # Required. The audio data to be recognized.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400100 # Either `content` or `uri` must be supplied. Supplying both or neither
101 # returns google.rpc.Code.INVALID_ARGUMENT. See
Dan O'Mearadd494642020-05-01 07:42:23 -0700102 # [content limits](https://cloud.google.com/speech-to-text/quotas#content).
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400103 "content": "A String", # The audio data bytes encoded as specified in
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700104 # `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400105 # pure binary representation, whereas JSON representations use base64.
106 "uri": "A String", # URI that points to a file that contains audio data bytes as specified in
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700107 # `RecognitionConfig`. The file must not be compressed (for example, gzip).
108 # Currently, only Google Cloud Storage URIs are
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400109 # supported, which must be specified in the following format:
110 # `gs://bucket_name/object_name` (other URI formats return
111 # google.rpc.Code.INVALID_ARGUMENT). For more information, see
112 # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
113 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700114 "config": { # Provides information to the recognizer that specifies how to process the # Required. Provides information to the recognizer that specifies how to
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400115 # process the request.
116 # request.
Dan O'Mearadd494642020-05-01 07:42:23 -0700117 "languageCode": "A String", # Required. The language of the supplied audio as a
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400118 # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
119 # Example: "en-US".
Dan O'Mearadd494642020-05-01 07:42:23 -0700120 # See [Language
121 # Support](https://cloud.google.com/speech-to-text/docs/languages) for a list
122 # of the currently supported language codes.
123 "audioChannelCount": 42, # The number of channels in the input audio data.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700124 # ONLY set this for MULTI-CHANNEL recognition.
125 # Valid values for LINEAR16 and FLAC are `1`-`8`.
126 # Valid values for OGG_OPUS are '1'-'254'.
127 # Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only `1`.
128 # If `0` or omitted, defaults to one channel (mono).
129 # Note: We only recognize the first channel by default.
130 # To perform independent recognition on each channel set
131 # `enable_separate_recognition_per_channel` to 'true'.
132 "encoding": "A String", # Encoding of audio data sent in all `RecognitionAudio` messages.
133 # This field is optional for `FLAC` and `WAV` audio files and required
134 # for all other audio formats. For details, see AudioEncoding.
Dan O'Mearadd494642020-05-01 07:42:23 -0700135 "enableAutomaticPunctuation": True or False, # If 'true', adds punctuation to recognition result hypotheses.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700136 # This feature is only available in select languages. Setting this for
137 # requests in other languages has no effect at all.
138 # The default 'false' value does not add punctuation to result hypotheses.
Dan O'Mearadd494642020-05-01 07:42:23 -0700139 "enableSeparateRecognitionPerChannel": True or False, # This needs to be set to `true` explicitly and `audio_channel_count` &gt; 1
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700140 # to get each channel recognized separately. The recognition result will
141 # contain a `channel_tag` field to state which channel that result belongs
142 # to. If this is not true, we will only recognize the first channel. The
143 # request is billed cumulatively for all channels recognized:
144 # `audio_channel_count` multiplied by the length of the audio.
Dan O'Mearadd494642020-05-01 07:42:23 -0700145 "enableWordTimeOffsets": True or False, # If `true`, the top result includes a list of words and
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700146 # the start and end time offsets (timestamps) for those words. If
147 # `false`, no word-level time offset information is returned. The default is
148 # `false`.
Dan O'Mearadd494642020-05-01 07:42:23 -0700149 "maxAlternatives": 42, # Maximum number of recognition hypotheses to be returned.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400150 # Specifically, the maximum number of `SpeechRecognitionAlternative` messages
151 # within each `SpeechRecognitionResult`.
152 # The server may return fewer than `max_alternatives`.
153 # Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
154 # one. If omitted, will return a maximum of one.
Dan O'Mearadd494642020-05-01 07:42:23 -0700155 "useEnhanced": True or False, # Set to true to use an enhanced model for speech recognition.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700156 # If `use_enhanced` is set to true and the `model` field is not set, then
Dan O'Mearadd494642020-05-01 07:42:23 -0700157 # an appropriate enhanced model is chosen if an enhanced model exists for
158 # the audio.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700159 #
160 # If `use_enhanced` is true and an enhanced version of the specified model
161 # does not exist, then the speech is recognized using the standard version
162 # of the specified model.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700163 "sampleRateHertz": 42, # Sample rate in Hertz of the audio data sent in all
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400164 # `RecognitionAudio` messages. Valid values are: 8000-48000.
165 # 16000 is optimal. For best results, set the sampling rate of the audio
166 # source to 16000 Hz. If that's not possible, use the native sample rate of
167 # the audio source (instead of re-sampling).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700168 # This field is optional for FLAC and WAV audio files, but is
169 # required for all other audio formats. For details, see AudioEncoding.
Dan O'Mearadd494642020-05-01 07:42:23 -0700170 "profanityFilter": True or False, # If set to `true`, the server will attempt to filter out
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400171 # profanities, replacing all but the initial character in each filtered word
172 # with asterisks, e.g. "f***". If set to `false` or omitted, profanities
173 # won't be filtered out.
Dan O'Mearadd494642020-05-01 07:42:23 -0700174 "model": "A String", # Which model to select for the given request. Select the model
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700175 # best suited to your domain to get best results. If a model is not
176 # explicitly specified, then we auto-select a model based on the parameters
177 # in the RecognitionConfig.
Dan O'Mearadd494642020-05-01 07:42:23 -0700178 # &lt;table&gt;
179 # &lt;tr&gt;
180 # &lt;td&gt;&lt;b&gt;Model&lt;/b&gt;&lt;/td&gt;
181 # &lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;
182 # &lt;/tr&gt;
183 # &lt;tr&gt;
184 # &lt;td&gt;&lt;code&gt;command_and_search&lt;/code&gt;&lt;/td&gt;
185 # &lt;td&gt;Best for short queries such as voice commands or voice search.&lt;/td&gt;
186 # &lt;/tr&gt;
187 # &lt;tr&gt;
188 # &lt;td&gt;&lt;code&gt;phone_call&lt;/code&gt;&lt;/td&gt;
189 # &lt;td&gt;Best for audio that originated from a phone call (typically
190 # recorded at an 8khz sampling rate).&lt;/td&gt;
191 # &lt;/tr&gt;
192 # &lt;tr&gt;
193 # &lt;td&gt;&lt;code&gt;video&lt;/code&gt;&lt;/td&gt;
194 # &lt;td&gt;Best for audio that originated from from video or includes multiple
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700195 # speakers. Ideally the audio is recorded at a 16khz or greater
196 # sampling rate. This is a premium model that costs more than the
Dan O'Mearadd494642020-05-01 07:42:23 -0700197 # standard rate.&lt;/td&gt;
198 # &lt;/tr&gt;
199 # &lt;tr&gt;
200 # &lt;td&gt;&lt;code&gt;default&lt;/code&gt;&lt;/td&gt;
201 # &lt;td&gt;Best for audio that is not one of the specific audio models.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700202 # For example, long-form audio. Ideally the audio is high-fidelity,
Dan O'Mearadd494642020-05-01 07:42:23 -0700203 # recorded at a 16khz or greater sampling rate.&lt;/td&gt;
204 # &lt;/tr&gt;
205 # &lt;/table&gt;
206 "diarizationConfig": { # Config to enable speaker diarization. # Config to enable speaker diarization and set additional
207 # parameters to make diarization better suited for your application.
208 # Note: When this is enabled, we send all the words from the beginning of the
209 # audio for the top alternative in every consecutive STREAMING responses.
210 # This is done in order to improve our speaker tags as our models learn to
211 # identify the speakers in the conversation over time.
212 # For non-streaming requests, the diarization results will be provided only
213 # in the top alternative of the FINAL SpeechRecognitionResult.
214 "minSpeakerCount": 42, # Minimum number of speakers in the conversation. This range gives you more
215 # flexibility by allowing the system to automatically determine the correct
216 # number of speakers. If not set, the default value is 2.
217 "enableSpeakerDiarization": True or False, # If 'true', enables speaker detection for each recognized word in
218 # the top alternative of the recognition result using a speaker_tag provided
219 # in the WordInfo.
220 "maxSpeakerCount": 42, # Maximum number of speakers in the conversation. This range gives you more
221 # flexibility by allowing the system to automatically determine the correct
222 # number of speakers. If not set, the default value is 6.
223 "speakerTag": 42, # Output only. Unused.
224 },
225 "speechContexts": [ # Array of SpeechContext.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700226 # A means to provide context to assist the speech recognition. For more
Dan O'Mearadd494642020-05-01 07:42:23 -0700227 # information, see
228 # [speech
229 # adaptation](https://cloud.google.com/speech-to-text/docs/context-strength).
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400230 { # Provides "hints" to the speech recognizer to favor specific words and phrases
231 # in the results.
Dan O'Mearadd494642020-05-01 07:42:23 -0700232 "phrases": [ # A list of strings containing words and phrases "hints" so that
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400233 # the speech recognition is more likely to recognize them. This can be used
234 # to improve the accuracy for specific words and phrases, for example, if
235 # specific commands are typically spoken by the user. This can also be used
236 # to add additional words to the vocabulary of the recognizer. See
Dan O'Mearadd494642020-05-01 07:42:23 -0700237 # [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700238 #
239 # List items can also be set to classes for groups of words that represent
240 # common concepts that occur in natural language. For example, rather than
241 # providing phrase hints for every month of the year, using the $MONTH class
242 # improves the likelihood of correctly transcribing audio that includes
243 # months.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400244 "A String",
245 ],
246 },
247 ],
Dan O'Mearadd494642020-05-01 07:42:23 -0700248 "metadata": { # Description of audio data to be recognized. # Metadata regarding this request.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700249 "recordingDeviceType": "A String", # The type of device the speech was recorded with.
250 "originalMediaType": "A String", # The original media the speech was recorded on.
251 "microphoneDistance": "A String", # The audio type that most closely describes the audio being recognized.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700252 "originalMimeType": "A String", # Mime type of the original audio file. For example `audio/m4a`,
253 # `audio/x-alaw-basic`, `audio/mp3`, `audio/3gpp`.
254 # A list of possible audio mime types is maintained at
255 # http://www.iana.org/assignments/media-types/media-types.xhtml#audio
256 "industryNaicsCodeOfAudio": 42, # The industry vertical to which this speech recognition request most
257 # closely applies. This is most indicative of the topics contained
258 # in the audio. Use the 6-digit NAICS code to identify the industry
259 # vertical - see https://www.naics.com/search/.
260 "audioTopic": "A String", # Description of the content. Eg. "Recordings of federal supreme court
261 # hearings from 2012".
262 "recordingDeviceName": "A String", # The device used to make the recording. Examples 'Nexus 5X' or
263 # 'Polycom SoundStation IP 6000' or 'POTS' or 'VoIP' or
264 # 'Cardioid Microphone'.
265 "interactionType": "A String", # The use case most closely describing the audio content to be recognized.
266 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400267 },
268 }
269
270 x__xgafv: string, V1 error format.
271 Allowed values
272 1 - v1 error format
273 2 - v2 error format
274
275Returns:
276 An object of the form:
277
278 { # This resource represents a long-running operation that is the result of a
279 # network API call.
Dan O'Mearadd494642020-05-01 07:42:23 -0700280 "metadata": { # Service-specific metadata associated with the operation. It typically
281 # contains progress information and common metadata such as create time.
282 # Some services might not provide such metadata. Any method that returns a
283 # long-running operation should document the metadata type, if any.
284 "a_key": "", # Properties of the object. Contains field @type with type URL.
285 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700286 "error": { # The `Status` type defines a logical error model that is suitable for # The error result of the operation in case of failure or cancellation.
287 # different programming environments, including REST APIs and RPC APIs. It is
288 # used by [gRPC](https://github.com/grpc). Each `Status` message contains
289 # three pieces of data: error code, error message, and error details.
290 #
291 # You can find out more about this error model and how to work with it in the
292 # [API Design Guide](https://cloud.google.com/apis/design/errors).
293 "message": "A String", # A developer-facing error message, which should be in English. Any
294 # user-facing error message should be localized and sent in the
295 # google.rpc.Status.details field, or localized by the client.
296 "code": 42, # The status code, which should be an enum value of google.rpc.Code.
297 "details": [ # A list of messages that carry the error details. There is a common set of
298 # message types for APIs to use.
299 {
300 "a_key": "", # Properties of the object. Contains field @type with type URL.
301 },
302 ],
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400303 },
304 "done": True or False, # If the value is `false`, it means the operation is still in progress.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700305 # If `true`, the operation is completed, and either `error` or `response` is
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400306 # available.
307 "response": { # The normal response of the operation in case of success. If the original
308 # method returns no data on success, such as `Delete`, the response is
309 # `google.protobuf.Empty`. If the original method is standard
310 # `Get`/`Create`/`Update`, the response should be the resource. For other
311 # methods, the response should have the type `XxxResponse`, where `Xxx`
312 # is the original method name. For example, if the original method name
313 # is `TakeSnapshot()`, the inferred response type is
314 # `TakeSnapshotResponse`.
315 "a_key": "", # Properties of the object. Contains field @type with type URL.
316 },
317 "name": "A String", # The server-assigned name, which is only unique within the same service that
318 # originally returns it. If you use the default HTTP mapping, the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700319 # `name` should be a resource name ending with `operations/{unique_id}`.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400320 }</pre>
321</div>
322
323<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700324 <code class="details" id="recognize">recognize(body=None, x__xgafv=None)</code>
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400325 <pre>Performs synchronous speech recognition: receive results after all audio
326has been sent and processed.
327
328Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700329 body: object, The request body.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400330 The object takes the form of:
331
332{ # The top-level message sent by the client for the `Recognize` method.
Dan O'Mearadd494642020-05-01 07:42:23 -0700333 "audio": { # Contains audio data in the encoding specified in the `RecognitionConfig`. # Required. The audio data to be recognized.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400334 # Either `content` or `uri` must be supplied. Supplying both or neither
335 # returns google.rpc.Code.INVALID_ARGUMENT. See
Dan O'Mearadd494642020-05-01 07:42:23 -0700336 # [content limits](https://cloud.google.com/speech-to-text/quotas#content).
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400337 "content": "A String", # The audio data bytes encoded as specified in
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700338 # `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400339 # pure binary representation, whereas JSON representations use base64.
340 "uri": "A String", # URI that points to a file that contains audio data bytes as specified in
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700341 # `RecognitionConfig`. The file must not be compressed (for example, gzip).
342 # Currently, only Google Cloud Storage URIs are
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400343 # supported, which must be specified in the following format:
344 # `gs://bucket_name/object_name` (other URI formats return
345 # google.rpc.Code.INVALID_ARGUMENT). For more information, see
346 # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
347 },
Dan O'Mearadd494642020-05-01 07:42:23 -0700348 "config": { # Provides information to the recognizer that specifies how to process the # Required. Provides information to the recognizer that specifies how to
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400349 # process the request.
350 # request.
Dan O'Mearadd494642020-05-01 07:42:23 -0700351 "languageCode": "A String", # Required. The language of the supplied audio as a
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400352 # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
353 # Example: "en-US".
Dan O'Mearadd494642020-05-01 07:42:23 -0700354 # See [Language
355 # Support](https://cloud.google.com/speech-to-text/docs/languages) for a list
356 # of the currently supported language codes.
357 "audioChannelCount": 42, # The number of channels in the input audio data.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700358 # ONLY set this for MULTI-CHANNEL recognition.
359 # Valid values for LINEAR16 and FLAC are `1`-`8`.
360 # Valid values for OGG_OPUS are '1'-'254'.
361 # Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only `1`.
362 # If `0` or omitted, defaults to one channel (mono).
363 # Note: We only recognize the first channel by default.
364 # To perform independent recognition on each channel set
365 # `enable_separate_recognition_per_channel` to 'true'.
366 "encoding": "A String", # Encoding of audio data sent in all `RecognitionAudio` messages.
367 # This field is optional for `FLAC` and `WAV` audio files and required
368 # for all other audio formats. For details, see AudioEncoding.
Dan O'Mearadd494642020-05-01 07:42:23 -0700369 "enableAutomaticPunctuation": True or False, # If 'true', adds punctuation to recognition result hypotheses.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700370 # This feature is only available in select languages. Setting this for
371 # requests in other languages has no effect at all.
372 # The default 'false' value does not add punctuation to result hypotheses.
Dan O'Mearadd494642020-05-01 07:42:23 -0700373 "enableSeparateRecognitionPerChannel": True or False, # This needs to be set to `true` explicitly and `audio_channel_count` &gt; 1
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700374 # to get each channel recognized separately. The recognition result will
375 # contain a `channel_tag` field to state which channel that result belongs
376 # to. If this is not true, we will only recognize the first channel. The
377 # request is billed cumulatively for all channels recognized:
378 # `audio_channel_count` multiplied by the length of the audio.
Dan O'Mearadd494642020-05-01 07:42:23 -0700379 "enableWordTimeOffsets": True or False, # If `true`, the top result includes a list of words and
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700380 # the start and end time offsets (timestamps) for those words. If
381 # `false`, no word-level time offset information is returned. The default is
382 # `false`.
Dan O'Mearadd494642020-05-01 07:42:23 -0700383 "maxAlternatives": 42, # Maximum number of recognition hypotheses to be returned.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400384 # Specifically, the maximum number of `SpeechRecognitionAlternative` messages
385 # within each `SpeechRecognitionResult`.
386 # The server may return fewer than `max_alternatives`.
387 # Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
388 # one. If omitted, will return a maximum of one.
Dan O'Mearadd494642020-05-01 07:42:23 -0700389 "useEnhanced": True or False, # Set to true to use an enhanced model for speech recognition.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700390 # If `use_enhanced` is set to true and the `model` field is not set, then
Dan O'Mearadd494642020-05-01 07:42:23 -0700391 # an appropriate enhanced model is chosen if an enhanced model exists for
392 # the audio.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700393 #
394 # If `use_enhanced` is true and an enhanced version of the specified model
395 # does not exist, then the speech is recognized using the standard version
396 # of the specified model.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700397 "sampleRateHertz": 42, # Sample rate in Hertz of the audio data sent in all
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400398 # `RecognitionAudio` messages. Valid values are: 8000-48000.
399 # 16000 is optimal. For best results, set the sampling rate of the audio
400 # source to 16000 Hz. If that's not possible, use the native sample rate of
401 # the audio source (instead of re-sampling).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700402 # This field is optional for FLAC and WAV audio files, but is
403 # required for all other audio formats. For details, see AudioEncoding.
Dan O'Mearadd494642020-05-01 07:42:23 -0700404 "profanityFilter": True or False, # If set to `true`, the server will attempt to filter out
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400405 # profanities, replacing all but the initial character in each filtered word
406 # with asterisks, e.g. "f***". If set to `false` or omitted, profanities
407 # won't be filtered out.
Dan O'Mearadd494642020-05-01 07:42:23 -0700408 "model": "A String", # Which model to select for the given request. Select the model
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700409 # best suited to your domain to get best results. If a model is not
410 # explicitly specified, then we auto-select a model based on the parameters
411 # in the RecognitionConfig.
Dan O'Mearadd494642020-05-01 07:42:23 -0700412 # &lt;table&gt;
413 # &lt;tr&gt;
414 # &lt;td&gt;&lt;b&gt;Model&lt;/b&gt;&lt;/td&gt;
415 # &lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;
416 # &lt;/tr&gt;
417 # &lt;tr&gt;
418 # &lt;td&gt;&lt;code&gt;command_and_search&lt;/code&gt;&lt;/td&gt;
419 # &lt;td&gt;Best for short queries such as voice commands or voice search.&lt;/td&gt;
420 # &lt;/tr&gt;
421 # &lt;tr&gt;
422 # &lt;td&gt;&lt;code&gt;phone_call&lt;/code&gt;&lt;/td&gt;
423 # &lt;td&gt;Best for audio that originated from a phone call (typically
424 # recorded at an 8khz sampling rate).&lt;/td&gt;
425 # &lt;/tr&gt;
426 # &lt;tr&gt;
427 # &lt;td&gt;&lt;code&gt;video&lt;/code&gt;&lt;/td&gt;
428 # &lt;td&gt;Best for audio that originated from from video or includes multiple
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700429 # speakers. Ideally the audio is recorded at a 16khz or greater
430 # sampling rate. This is a premium model that costs more than the
Dan O'Mearadd494642020-05-01 07:42:23 -0700431 # standard rate.&lt;/td&gt;
432 # &lt;/tr&gt;
433 # &lt;tr&gt;
434 # &lt;td&gt;&lt;code&gt;default&lt;/code&gt;&lt;/td&gt;
435 # &lt;td&gt;Best for audio that is not one of the specific audio models.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700436 # For example, long-form audio. Ideally the audio is high-fidelity,
Dan O'Mearadd494642020-05-01 07:42:23 -0700437 # recorded at a 16khz or greater sampling rate.&lt;/td&gt;
438 # &lt;/tr&gt;
439 # &lt;/table&gt;
440 "diarizationConfig": { # Config to enable speaker diarization. # Config to enable speaker diarization and set additional
441 # parameters to make diarization better suited for your application.
442 # Note: When this is enabled, we send all the words from the beginning of the
443 # audio for the top alternative in every consecutive STREAMING responses.
444 # This is done in order to improve our speaker tags as our models learn to
445 # identify the speakers in the conversation over time.
446 # For non-streaming requests, the diarization results will be provided only
447 # in the top alternative of the FINAL SpeechRecognitionResult.
448 "minSpeakerCount": 42, # Minimum number of speakers in the conversation. This range gives you more
449 # flexibility by allowing the system to automatically determine the correct
450 # number of speakers. If not set, the default value is 2.
451 "enableSpeakerDiarization": True or False, # If 'true', enables speaker detection for each recognized word in
452 # the top alternative of the recognition result using a speaker_tag provided
453 # in the WordInfo.
454 "maxSpeakerCount": 42, # Maximum number of speakers in the conversation. This range gives you more
455 # flexibility by allowing the system to automatically determine the correct
456 # number of speakers. If not set, the default value is 6.
457 "speakerTag": 42, # Output only. Unused.
458 },
459 "speechContexts": [ # Array of SpeechContext.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700460 # A means to provide context to assist the speech recognition. For more
Dan O'Mearadd494642020-05-01 07:42:23 -0700461 # information, see
462 # [speech
463 # adaptation](https://cloud.google.com/speech-to-text/docs/context-strength).
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400464 { # Provides "hints" to the speech recognizer to favor specific words and phrases
465 # in the results.
Dan O'Mearadd494642020-05-01 07:42:23 -0700466 "phrases": [ # A list of strings containing words and phrases "hints" so that
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400467 # the speech recognition is more likely to recognize them. This can be used
468 # to improve the accuracy for specific words and phrases, for example, if
469 # specific commands are typically spoken by the user. This can also be used
470 # to add additional words to the vocabulary of the recognizer. See
Dan O'Mearadd494642020-05-01 07:42:23 -0700471 # [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700472 #
473 # List items can also be set to classes for groups of words that represent
474 # common concepts that occur in natural language. For example, rather than
475 # providing phrase hints for every month of the year, using the $MONTH class
476 # improves the likelihood of correctly transcribing audio that includes
477 # months.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400478 "A String",
479 ],
480 },
481 ],
Dan O'Mearadd494642020-05-01 07:42:23 -0700482 "metadata": { # Description of audio data to be recognized. # Metadata regarding this request.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700483 "recordingDeviceType": "A String", # The type of device the speech was recorded with.
484 "originalMediaType": "A String", # The original media the speech was recorded on.
485 "microphoneDistance": "A String", # The audio type that most closely describes the audio being recognized.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700486 "originalMimeType": "A String", # Mime type of the original audio file. For example `audio/m4a`,
487 # `audio/x-alaw-basic`, `audio/mp3`, `audio/3gpp`.
488 # A list of possible audio mime types is maintained at
489 # http://www.iana.org/assignments/media-types/media-types.xhtml#audio
490 "industryNaicsCodeOfAudio": 42, # The industry vertical to which this speech recognition request most
491 # closely applies. This is most indicative of the topics contained
492 # in the audio. Use the 6-digit NAICS code to identify the industry
493 # vertical - see https://www.naics.com/search/.
494 "audioTopic": "A String", # Description of the content. Eg. "Recordings of federal supreme court
495 # hearings from 2012".
496 "recordingDeviceName": "A String", # The device used to make the recording. Examples 'Nexus 5X' or
497 # 'Polycom SoundStation IP 6000' or 'POTS' or 'VoIP' or
498 # 'Cardioid Microphone'.
499 "interactionType": "A String", # The use case most closely describing the audio content to be recognized.
500 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400501 },
502 }
503
504 x__xgafv: string, V1 error format.
505 Allowed values
506 1 - v1 error format
507 2 - v2 error format
508
509Returns:
510 An object of the form:
511
512 { # The only message returned to the client by the `Recognize` method. It
513 # contains the result as zero or more sequential `SpeechRecognitionResult`
514 # messages.
Dan O'Mearadd494642020-05-01 07:42:23 -0700515 "results": [ # Sequential list of transcription results corresponding to
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400516 # sequential portions of audio.
517 { # A speech recognition result corresponding to a portion of the audio.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700518 "channelTag": 42, # For multi-channel audio, this is the channel number corresponding to the
519 # recognized result for the audio from that channel.
520 # For audio_channel_count = N, its output values can range from '1' to 'N'.
Dan O'Mearadd494642020-05-01 07:42:23 -0700521 "alternatives": [ # May contain one or more recognition hypotheses (up to the
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400522 # maximum specified in `max_alternatives`).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700523 # These alternatives are ordered in terms of accuracy, with the top (first)
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400524 # alternative being the most probable, as ranked by the recognizer.
525 { # Alternative hypotheses (a.k.a. n-best list).
Dan O'Mearadd494642020-05-01 07:42:23 -0700526 "confidence": 3.14, # The confidence estimate between 0.0 and 1.0. A higher number
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400527 # indicates an estimated greater likelihood that the recognized words are
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700528 # correct. This field is set only for the top alternative of a non-streaming
529 # result or, of a streaming result where `is_final=true`.
530 # This field is not guaranteed to be accurate and users should not rely on it
531 # to be always provided.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400532 # The default of 0.0 is a sentinel value indicating `confidence` was not set.
Dan O'Mearadd494642020-05-01 07:42:23 -0700533 "transcript": "A String", # Transcript text representing the words that the user spoke.
534 "words": [ # A list of word-specific information for each recognized word.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700535 # Note: When `enable_speaker_diarization` is true, you will see all the words
536 # from the beginning of the audio.
537 { # Word-specific information for recognized words.
Dan O'Mearadd494642020-05-01 07:42:23 -0700538 "endTime": "A String", # Time offset relative to the beginning of the audio,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700539 # and corresponding to the end of the spoken word.
540 # This field is only set if `enable_word_time_offsets=true` and only
541 # in the top hypothesis.
542 # This is an experimental feature and the accuracy of the time offset can
543 # vary.
Dan O'Mearadd494642020-05-01 07:42:23 -0700544 "word": "A String", # The word corresponding to this set of information.
545 "startTime": "A String", # Time offset relative to the beginning of the audio,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700546 # and corresponding to the start of the spoken word.
547 # This field is only set if `enable_word_time_offsets=true` and only
548 # in the top hypothesis.
549 # This is an experimental feature and the accuracy of the time offset can
550 # vary.
Dan O'Mearadd494642020-05-01 07:42:23 -0700551 "speakerTag": 42, # Output only. A distinct integer value is assigned for every speaker within
552 # the audio. This field specifies which one of those speakers was detected to
553 # have spoken this word. Value ranges from '1' to diarization_speaker_count.
554 # speaker_tag is set if enable_speaker_diarization = 'true' and only in the
555 # top alternative.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700556 },
557 ],
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400558 },
559 ],
560 },
561 ],
562 }</pre>
563</div>
564
565</body></html>