blob: fe57ccee01d03e9e60473bba1b1af6c515897107 [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.
Bu Sun Kimd059ad82020-07-22 17:02:09 -070099 &quot;audio&quot;: { # Contains audio data in the encoding specified in the `RecognitionConfig`. # Required. The audio data to be recognized.
100 # Either `content` or `uri` must be supplied. Supplying both or neither
101 # returns google.rpc.Code.INVALID_ARGUMENT. See
102 # [content limits](https://cloud.google.com/speech-to-text/quotas#content).
103 &quot;uri&quot;: &quot;A String&quot;, # URI that points to a file that contains audio data bytes as specified in
104 # `RecognitionConfig`. The file must not be compressed (for example, gzip).
105 # Currently, only Google Cloud Storage URIs are
106 # supported, which must be specified in the following format:
107 # `gs://bucket_name/object_name` (other URI formats return
108 # google.rpc.Code.INVALID_ARGUMENT). For more information, see
109 # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
110 &quot;content&quot;: &quot;A String&quot;, # The audio data bytes encoded as specified in
111 # `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
112 # pure binary representation, whereas JSON representations use base64.
113 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700114 &quot;config&quot;: { # 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.
Bu Sun Kim65020912020-05-20 12:08:20 -0700117 &quot;speechContexts&quot;: [ # Array of SpeechContext.
118 # A means to provide context to assist the speech recognition. For more
119 # information, see
120 # [speech
121 # adaptation](https://cloud.google.com/speech-to-text/docs/context-strength).
122 { # Provides &quot;hints&quot; to the speech recognizer to favor specific words and phrases
123 # in the results.
124 &quot;phrases&quot;: [ # A list of strings containing words and phrases &quot;hints&quot; so that
125 # the speech recognition is more likely to recognize them. This can be used
126 # to improve the accuracy for specific words and phrases, for example, if
127 # specific commands are typically spoken by the user. This can also be used
128 # to add additional words to the vocabulary of the recognizer. See
129 # [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
130 #
131 # List items can also be set to classes for groups of words that represent
132 # common concepts that occur in natural language. For example, rather than
133 # providing phrase hints for every month of the year, using the $MONTH class
134 # improves the likelihood of correctly transcribing audio that includes
135 # months.
136 &quot;A String&quot;,
137 ],
138 },
139 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700140 &quot;languageCode&quot;: &quot;A String&quot;, # Required. The language of the supplied audio as a
141 # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
142 # Example: &quot;en-US&quot;.
143 # See [Language
144 # Support](https://cloud.google.com/speech-to-text/docs/languages) for a list
145 # of the currently supported language codes.
146 &quot;useEnhanced&quot;: True or False, # Set to true to use an enhanced model for speech recognition.
147 # If `use_enhanced` is set to true and the `model` field is not set, then
148 # an appropriate enhanced model is chosen if an enhanced model exists for
149 # the audio.
150 #
151 # If `use_enhanced` is true and an enhanced version of the specified model
152 # does not exist, then the speech is recognized using the standard version
153 # of the specified model.
154 &quot;enableWordTimeOffsets&quot;: True or False, # If `true`, the top result includes a list of words and
155 # the start and end time offsets (timestamps) for those words. If
156 # `false`, no word-level time offset information is returned. The default is
157 # `false`.
158 &quot;diarizationConfig&quot;: { # Config to enable speaker diarization. # Config to enable speaker diarization and set additional
159 # parameters to make diarization better suited for your application.
160 # Note: When this is enabled, we send all the words from the beginning of the
161 # audio for the top alternative in every consecutive STREAMING responses.
162 # This is done in order to improve our speaker tags as our models learn to
163 # identify the speakers in the conversation over time.
164 # For non-streaming requests, the diarization results will be provided only
165 # in the top alternative of the FINAL SpeechRecognitionResult.
166 &quot;speakerTag&quot;: 42, # Output only. Unused.
167 &quot;minSpeakerCount&quot;: 42, # Minimum number of speakers in the conversation. This range gives you more
168 # flexibility by allowing the system to automatically determine the correct
169 # number of speakers. If not set, the default value is 2.
170 &quot;enableSpeakerDiarization&quot;: True or False, # If &#x27;true&#x27;, enables speaker detection for each recognized word in
171 # the top alternative of the recognition result using a speaker_tag provided
172 # in the WordInfo.
173 &quot;maxSpeakerCount&quot;: 42, # Maximum number of speakers in the conversation. This range gives you more
174 # flexibility by allowing the system to automatically determine the correct
175 # number of speakers. If not set, the default value is 6.
176 },
177 &quot;profanityFilter&quot;: True or False, # If set to `true`, the server will attempt to filter out
178 # profanities, replacing all but the initial character in each filtered word
179 # with asterisks, e.g. &quot;f***&quot;. If set to `false` or omitted, profanities
180 # won&#x27;t be filtered out.
181 &quot;enableAutomaticPunctuation&quot;: True or False, # If &#x27;true&#x27;, adds punctuation to recognition result hypotheses.
182 # This feature is only available in select languages. Setting this for
183 # requests in other languages has no effect at all.
184 # The default &#x27;false&#x27; value does not add punctuation to result hypotheses.
185 &quot;enableSeparateRecognitionPerChannel&quot;: True or False, # This needs to be set to `true` explicitly and `audio_channel_count` &gt; 1
186 # to get each channel recognized separately. The recognition result will
187 # contain a `channel_tag` field to state which channel that result belongs
188 # to. If this is not true, we will only recognize the first channel. The
189 # request is billed cumulatively for all channels recognized:
190 # `audio_channel_count` multiplied by the length of the audio.
191 &quot;sampleRateHertz&quot;: 42, # Sample rate in Hertz of the audio data sent in all
192 # `RecognitionAudio` messages. Valid values are: 8000-48000.
193 # 16000 is optimal. For best results, set the sampling rate of the audio
194 # source to 16000 Hz. If that&#x27;s not possible, use the native sample rate of
195 # the audio source (instead of re-sampling).
196 # This field is optional for FLAC and WAV audio files, but is
197 # required for all other audio formats. For details, see AudioEncoding.
198 &quot;metadata&quot;: { # Description of audio data to be recognized. # Metadata regarding this request.
199 &quot;originalMediaType&quot;: &quot;A String&quot;, # The original media the speech was recorded on.
200 &quot;recordingDeviceName&quot;: &quot;A String&quot;, # The device used to make the recording. Examples &#x27;Nexus 5X&#x27; or
201 # &#x27;Polycom SoundStation IP 6000&#x27; or &#x27;POTS&#x27; or &#x27;VoIP&#x27; or
202 # &#x27;Cardioid Microphone&#x27;.
203 &quot;industryNaicsCodeOfAudio&quot;: 42, # The industry vertical to which this speech recognition request most
204 # closely applies. This is most indicative of the topics contained
205 # in the audio. Use the 6-digit NAICS code to identify the industry
206 # vertical - see https://www.naics.com/search/.
207 &quot;originalMimeType&quot;: &quot;A String&quot;, # Mime type of the original audio file. For example `audio/m4a`,
208 # `audio/x-alaw-basic`, `audio/mp3`, `audio/3gpp`.
209 # A list of possible audio mime types is maintained at
210 # http://www.iana.org/assignments/media-types/media-types.xhtml#audio
211 &quot;audioTopic&quot;: &quot;A String&quot;, # Description of the content. Eg. &quot;Recordings of federal supreme court
212 # hearings from 2012&quot;.
213 &quot;recordingDeviceType&quot;: &quot;A String&quot;, # The type of device the speech was recorded with.
214 &quot;microphoneDistance&quot;: &quot;A String&quot;, # The audio type that most closely describes the audio being recognized.
215 &quot;interactionType&quot;: &quot;A String&quot;, # The use case most closely describing the audio content to be recognized.
216 },
217 &quot;maxAlternatives&quot;: 42, # Maximum number of recognition hypotheses to be returned.
218 # Specifically, the maximum number of `SpeechRecognitionAlternative` messages
219 # within each `SpeechRecognitionResult`.
220 # The server may return fewer than `max_alternatives`.
221 # Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
222 # one. If omitted, will return a maximum of one.
223 &quot;audioChannelCount&quot;: 42, # The number of channels in the input audio data.
224 # ONLY set this for MULTI-CHANNEL recognition.
225 # Valid values for LINEAR16 and FLAC are `1`-`8`.
226 # Valid values for OGG_OPUS are &#x27;1&#x27;-&#x27;254&#x27;.
227 # Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only `1`.
228 # If `0` or omitted, defaults to one channel (mono).
229 # Note: We only recognize the first channel by default.
230 # To perform independent recognition on each channel set
231 # `enable_separate_recognition_per_channel` to &#x27;true&#x27;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700232 &quot;encoding&quot;: &quot;A String&quot;, # Encoding of audio data sent in all `RecognitionAudio` messages.
233 # This field is optional for `FLAC` and `WAV` audio files and required
234 # for all other audio formats. For details, see AudioEncoding.
Bu Sun Kim65020912020-05-20 12:08:20 -0700235 &quot;model&quot;: &quot;A String&quot;, # Which model to select for the given request. Select the model
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700236 # best suited to your domain to get best results. If a model is not
237 # explicitly specified, then we auto-select a model based on the parameters
238 # in the RecognitionConfig.
Dan O'Mearadd494642020-05-01 07:42:23 -0700239 # &lt;table&gt;
240 # &lt;tr&gt;
241 # &lt;td&gt;&lt;b&gt;Model&lt;/b&gt;&lt;/td&gt;
242 # &lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;
243 # &lt;/tr&gt;
244 # &lt;tr&gt;
245 # &lt;td&gt;&lt;code&gt;command_and_search&lt;/code&gt;&lt;/td&gt;
246 # &lt;td&gt;Best for short queries such as voice commands or voice search.&lt;/td&gt;
247 # &lt;/tr&gt;
248 # &lt;tr&gt;
249 # &lt;td&gt;&lt;code&gt;phone_call&lt;/code&gt;&lt;/td&gt;
250 # &lt;td&gt;Best for audio that originated from a phone call (typically
251 # recorded at an 8khz sampling rate).&lt;/td&gt;
252 # &lt;/tr&gt;
253 # &lt;tr&gt;
254 # &lt;td&gt;&lt;code&gt;video&lt;/code&gt;&lt;/td&gt;
255 # &lt;td&gt;Best for audio that originated from from video or includes multiple
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700256 # speakers. Ideally the audio is recorded at a 16khz or greater
257 # sampling rate. This is a premium model that costs more than the
Dan O'Mearadd494642020-05-01 07:42:23 -0700258 # standard rate.&lt;/td&gt;
259 # &lt;/tr&gt;
260 # &lt;tr&gt;
261 # &lt;td&gt;&lt;code&gt;default&lt;/code&gt;&lt;/td&gt;
262 # &lt;td&gt;Best for audio that is not one of the specific audio models.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700263 # For example, long-form audio. Ideally the audio is high-fidelity,
Dan O'Mearadd494642020-05-01 07:42:23 -0700264 # recorded at a 16khz or greater sampling rate.&lt;/td&gt;
265 # &lt;/tr&gt;
266 # &lt;/table&gt;
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.
Bu Sun Kim65020912020-05-20 12:08:20 -0700280 &quot;response&quot;: { # The normal response of the operation in case of success. If the original
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400281 # method returns no data on success, such as `Delete`, the response is
282 # `google.protobuf.Empty`. If the original method is standard
283 # `Get`/`Create`/`Update`, the response should be the resource. For other
284 # methods, the response should have the type `XxxResponse`, where `Xxx`
285 # is the original method name. For example, if the original method name
286 # is `TakeSnapshot()`, the inferred response type is
287 # `TakeSnapshotResponse`.
Bu Sun Kim65020912020-05-20 12:08:20 -0700288 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400289 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700290 &quot;metadata&quot;: { # Service-specific metadata associated with the operation. It typically
291 # contains progress information and common metadata such as create time.
292 # Some services might not provide such metadata. Any method that returns a
293 # long-running operation should document the metadata type, if any.
294 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
295 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700296 &quot;name&quot;: &quot;A String&quot;, # The server-assigned name, which is only unique within the same service that
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400297 # originally returns it. If you use the default HTTP mapping, the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700298 # `name` should be a resource name ending with `operations/{unique_id}`.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700299 &quot;done&quot;: True or False, # If the value is `false`, it means the operation is still in progress.
300 # If `true`, the operation is completed, and either `error` or `response` is
301 # available.
Bu Sun Kim65020912020-05-20 12:08:20 -0700302 &quot;error&quot;: { # The `Status` type defines a logical error model that is suitable for # The error result of the operation in case of failure or cancellation.
303 # different programming environments, including REST APIs and RPC APIs. It is
304 # used by [gRPC](https://github.com/grpc). Each `Status` message contains
305 # three pieces of data: error code, error message, and error details.
306 #
307 # You can find out more about this error model and how to work with it in the
308 # [API Design Guide](https://cloud.google.com/apis/design/errors).
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700309 &quot;message&quot;: &quot;A String&quot;, # A developer-facing error message, which should be in English. Any
310 # user-facing error message should be localized and sent in the
311 # google.rpc.Status.details field, or localized by the client.
312 &quot;code&quot;: 42, # The status code, which should be an enum value of google.rpc.Code.
Bu Sun Kim65020912020-05-20 12:08:20 -0700313 &quot;details&quot;: [ # A list of messages that carry the error details. There is a common set of
314 # message types for APIs to use.
315 {
316 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
317 },
318 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700319 },
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.
Bu Sun Kim65020912020-05-20 12:08:20 -0700333 &quot;config&quot;: { # 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 -0400334 # process the request.
335 # request.
Bu Sun Kim65020912020-05-20 12:08:20 -0700336 &quot;speechContexts&quot;: [ # Array of SpeechContext.
337 # A means to provide context to assist the speech recognition. For more
338 # information, see
339 # [speech
340 # adaptation](https://cloud.google.com/speech-to-text/docs/context-strength).
341 { # Provides &quot;hints&quot; to the speech recognizer to favor specific words and phrases
342 # in the results.
343 &quot;phrases&quot;: [ # A list of strings containing words and phrases &quot;hints&quot; so that
344 # the speech recognition is more likely to recognize them. This can be used
345 # to improve the accuracy for specific words and phrases, for example, if
346 # specific commands are typically spoken by the user. This can also be used
347 # to add additional words to the vocabulary of the recognizer. See
348 # [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
349 #
350 # List items can also be set to classes for groups of words that represent
351 # common concepts that occur in natural language. For example, rather than
352 # providing phrase hints for every month of the year, using the $MONTH class
353 # improves the likelihood of correctly transcribing audio that includes
354 # months.
355 &quot;A String&quot;,
356 ],
357 },
358 ],
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700359 &quot;languageCode&quot;: &quot;A String&quot;, # Required. The language of the supplied audio as a
360 # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
361 # Example: &quot;en-US&quot;.
362 # See [Language
363 # Support](https://cloud.google.com/speech-to-text/docs/languages) for a list
364 # of the currently supported language codes.
365 &quot;useEnhanced&quot;: True or False, # Set to true to use an enhanced model for speech recognition.
366 # If `use_enhanced` is set to true and the `model` field is not set, then
367 # an appropriate enhanced model is chosen if an enhanced model exists for
368 # the audio.
369 #
370 # If `use_enhanced` is true and an enhanced version of the specified model
371 # does not exist, then the speech is recognized using the standard version
372 # of the specified model.
373 &quot;enableWordTimeOffsets&quot;: True or False, # If `true`, the top result includes a list of words and
374 # the start and end time offsets (timestamps) for those words. If
375 # `false`, no word-level time offset information is returned. The default is
376 # `false`.
377 &quot;diarizationConfig&quot;: { # Config to enable speaker diarization. # Config to enable speaker diarization and set additional
378 # parameters to make diarization better suited for your application.
379 # Note: When this is enabled, we send all the words from the beginning of the
380 # audio for the top alternative in every consecutive STREAMING responses.
381 # This is done in order to improve our speaker tags as our models learn to
382 # identify the speakers in the conversation over time.
383 # For non-streaming requests, the diarization results will be provided only
384 # in the top alternative of the FINAL SpeechRecognitionResult.
385 &quot;speakerTag&quot;: 42, # Output only. Unused.
386 &quot;minSpeakerCount&quot;: 42, # Minimum number of speakers in the conversation. This range gives you more
387 # flexibility by allowing the system to automatically determine the correct
388 # number of speakers. If not set, the default value is 2.
389 &quot;enableSpeakerDiarization&quot;: True or False, # If &#x27;true&#x27;, enables speaker detection for each recognized word in
390 # the top alternative of the recognition result using a speaker_tag provided
391 # in the WordInfo.
392 &quot;maxSpeakerCount&quot;: 42, # Maximum number of speakers in the conversation. This range gives you more
393 # flexibility by allowing the system to automatically determine the correct
394 # number of speakers. If not set, the default value is 6.
395 },
396 &quot;profanityFilter&quot;: True or False, # If set to `true`, the server will attempt to filter out
397 # profanities, replacing all but the initial character in each filtered word
398 # with asterisks, e.g. &quot;f***&quot;. If set to `false` or omitted, profanities
399 # won&#x27;t be filtered out.
400 &quot;enableAutomaticPunctuation&quot;: True or False, # If &#x27;true&#x27;, adds punctuation to recognition result hypotheses.
401 # This feature is only available in select languages. Setting this for
402 # requests in other languages has no effect at all.
403 # The default &#x27;false&#x27; value does not add punctuation to result hypotheses.
404 &quot;enableSeparateRecognitionPerChannel&quot;: True or False, # This needs to be set to `true` explicitly and `audio_channel_count` &gt; 1
405 # to get each channel recognized separately. The recognition result will
406 # contain a `channel_tag` field to state which channel that result belongs
407 # to. If this is not true, we will only recognize the first channel. The
408 # request is billed cumulatively for all channels recognized:
409 # `audio_channel_count` multiplied by the length of the audio.
410 &quot;sampleRateHertz&quot;: 42, # Sample rate in Hertz of the audio data sent in all
411 # `RecognitionAudio` messages. Valid values are: 8000-48000.
412 # 16000 is optimal. For best results, set the sampling rate of the audio
413 # source to 16000 Hz. If that&#x27;s not possible, use the native sample rate of
414 # the audio source (instead of re-sampling).
415 # This field is optional for FLAC and WAV audio files, but is
416 # required for all other audio formats. For details, see AudioEncoding.
417 &quot;metadata&quot;: { # Description of audio data to be recognized. # Metadata regarding this request.
418 &quot;originalMediaType&quot;: &quot;A String&quot;, # The original media the speech was recorded on.
419 &quot;recordingDeviceName&quot;: &quot;A String&quot;, # The device used to make the recording. Examples &#x27;Nexus 5X&#x27; or
420 # &#x27;Polycom SoundStation IP 6000&#x27; or &#x27;POTS&#x27; or &#x27;VoIP&#x27; or
421 # &#x27;Cardioid Microphone&#x27;.
422 &quot;industryNaicsCodeOfAudio&quot;: 42, # The industry vertical to which this speech recognition request most
423 # closely applies. This is most indicative of the topics contained
424 # in the audio. Use the 6-digit NAICS code to identify the industry
425 # vertical - see https://www.naics.com/search/.
426 &quot;originalMimeType&quot;: &quot;A String&quot;, # Mime type of the original audio file. For example `audio/m4a`,
427 # `audio/x-alaw-basic`, `audio/mp3`, `audio/3gpp`.
428 # A list of possible audio mime types is maintained at
429 # http://www.iana.org/assignments/media-types/media-types.xhtml#audio
430 &quot;audioTopic&quot;: &quot;A String&quot;, # Description of the content. Eg. &quot;Recordings of federal supreme court
431 # hearings from 2012&quot;.
432 &quot;recordingDeviceType&quot;: &quot;A String&quot;, # The type of device the speech was recorded with.
433 &quot;microphoneDistance&quot;: &quot;A String&quot;, # The audio type that most closely describes the audio being recognized.
434 &quot;interactionType&quot;: &quot;A String&quot;, # The use case most closely describing the audio content to be recognized.
435 },
436 &quot;maxAlternatives&quot;: 42, # Maximum number of recognition hypotheses to be returned.
437 # Specifically, the maximum number of `SpeechRecognitionAlternative` messages
438 # within each `SpeechRecognitionResult`.
439 # The server may return fewer than `max_alternatives`.
440 # Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
441 # one. If omitted, will return a maximum of one.
442 &quot;audioChannelCount&quot;: 42, # The number of channels in the input audio data.
443 # ONLY set this for MULTI-CHANNEL recognition.
444 # Valid values for LINEAR16 and FLAC are `1`-`8`.
445 # Valid values for OGG_OPUS are &#x27;1&#x27;-&#x27;254&#x27;.
446 # Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only `1`.
447 # If `0` or omitted, defaults to one channel (mono).
448 # Note: We only recognize the first channel by default.
449 # To perform independent recognition on each channel set
450 # `enable_separate_recognition_per_channel` to &#x27;true&#x27;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700451 &quot;encoding&quot;: &quot;A String&quot;, # Encoding of audio data sent in all `RecognitionAudio` messages.
452 # This field is optional for `FLAC` and `WAV` audio files and required
453 # for all other audio formats. For details, see AudioEncoding.
Bu Sun Kim65020912020-05-20 12:08:20 -0700454 &quot;model&quot;: &quot;A String&quot;, # Which model to select for the given request. Select the model
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700455 # best suited to your domain to get best results. If a model is not
456 # explicitly specified, then we auto-select a model based on the parameters
457 # in the RecognitionConfig.
Dan O'Mearadd494642020-05-01 07:42:23 -0700458 # &lt;table&gt;
459 # &lt;tr&gt;
460 # &lt;td&gt;&lt;b&gt;Model&lt;/b&gt;&lt;/td&gt;
461 # &lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;
462 # &lt;/tr&gt;
463 # &lt;tr&gt;
464 # &lt;td&gt;&lt;code&gt;command_and_search&lt;/code&gt;&lt;/td&gt;
465 # &lt;td&gt;Best for short queries such as voice commands or voice search.&lt;/td&gt;
466 # &lt;/tr&gt;
467 # &lt;tr&gt;
468 # &lt;td&gt;&lt;code&gt;phone_call&lt;/code&gt;&lt;/td&gt;
469 # &lt;td&gt;Best for audio that originated from a phone call (typically
470 # recorded at an 8khz sampling rate).&lt;/td&gt;
471 # &lt;/tr&gt;
472 # &lt;tr&gt;
473 # &lt;td&gt;&lt;code&gt;video&lt;/code&gt;&lt;/td&gt;
474 # &lt;td&gt;Best for audio that originated from from video or includes multiple
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700475 # speakers. Ideally the audio is recorded at a 16khz or greater
476 # sampling rate. This is a premium model that costs more than the
Dan O'Mearadd494642020-05-01 07:42:23 -0700477 # standard rate.&lt;/td&gt;
478 # &lt;/tr&gt;
479 # &lt;tr&gt;
480 # &lt;td&gt;&lt;code&gt;default&lt;/code&gt;&lt;/td&gt;
481 # &lt;td&gt;Best for audio that is not one of the specific audio models.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700482 # For example, long-form audio. Ideally the audio is high-fidelity,
Dan O'Mearadd494642020-05-01 07:42:23 -0700483 # recorded at a 16khz or greater sampling rate.&lt;/td&gt;
484 # &lt;/tr&gt;
485 # &lt;/table&gt;
Bu Sun Kim65020912020-05-20 12:08:20 -0700486 },
487 &quot;audio&quot;: { # Contains audio data in the encoding specified in the `RecognitionConfig`. # Required. The audio data to be recognized.
488 # Either `content` or `uri` must be supplied. Supplying both or neither
489 # returns google.rpc.Code.INVALID_ARGUMENT. See
490 # [content limits](https://cloud.google.com/speech-to-text/quotas#content).
491 &quot;uri&quot;: &quot;A String&quot;, # URI that points to a file that contains audio data bytes as specified in
492 # `RecognitionConfig`. The file must not be compressed (for example, gzip).
493 # Currently, only Google Cloud Storage URIs are
494 # supported, which must be specified in the following format:
495 # `gs://bucket_name/object_name` (other URI formats return
496 # google.rpc.Code.INVALID_ARGUMENT). For more information, see
497 # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700498 &quot;content&quot;: &quot;A String&quot;, # The audio data bytes encoded as specified in
499 # `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
500 # pure binary representation, whereas JSON representations use base64.
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.
Bu Sun Kim65020912020-05-20 12:08:20 -0700515 &quot;results&quot;: [ # 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 Kim4ed7d3f2020-05-27 12:20:54 -0700518 &quot;channelTag&quot;: 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 &#x27;1&#x27; to &#x27;N&#x27;.
Bu Sun Kim65020912020-05-20 12:08:20 -0700521 &quot;alternatives&quot;: [ # 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).
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700526 &quot;transcript&quot;: &quot;A String&quot;, # Transcript text representing the words that the user spoke.
Bu Sun Kim65020912020-05-20 12:08:20 -0700527 &quot;confidence&quot;: 3.14, # The confidence estimate between 0.0 and 1.0. A higher number
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400528 # indicates an estimated greater likelihood that the recognized words are
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700529 # correct. This field is set only for the top alternative of a non-streaming
530 # result or, of a streaming result where `is_final=true`.
531 # This field is not guaranteed to be accurate and users should not rely on it
532 # to be always provided.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400533 # The default of 0.0 is a sentinel value indicating `confidence` was not set.
Bu Sun Kim65020912020-05-20 12:08:20 -0700534 &quot;words&quot;: [ # 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.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700538 &quot;speakerTag&quot;: 42, # Output only. A distinct integer value is assigned for every speaker within
539 # the audio. This field specifies which one of those speakers was detected to
540 # have spoken this word. Value ranges from &#x27;1&#x27; to diarization_speaker_count.
541 # speaker_tag is set if enable_speaker_diarization = &#x27;true&#x27; and only in the
542 # top alternative.
Bu Sun Kim65020912020-05-20 12:08:20 -0700543 &quot;endTime&quot;: &quot;A String&quot;, # Time offset relative to the beginning of the audio,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700544 # and corresponding to the end of the spoken word.
545 # This field is only set if `enable_word_time_offsets=true` and only
546 # in the top hypothesis.
547 # This is an experimental feature and the accuracy of the time offset can
548 # vary.
Bu Sun Kim65020912020-05-20 12:08:20 -0700549 &quot;startTime&quot;: &quot;A String&quot;, # Time offset relative to the beginning of the audio,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700550 # and corresponding to the start of the spoken word.
551 # This field is only set if `enable_word_time_offsets=true` and only
552 # in the top hypothesis.
553 # This is an experimental feature and the accuracy of the time offset can
554 # vary.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700555 &quot;word&quot;: &quot;A String&quot;, # The word corresponding to this set of information.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700556 },
557 ],
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400558 },
559 ],
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400560 },
561 ],
562 }</pre>
563</div>
564
565</body></html>