blob: fd71ac9f2a9680a7734f7c635f8ff3a38ea8f3fa [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 Kim65020912020-05-20 12:08:20 -070099 &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 -0400100 # process the request.
101 # request.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700102 &quot;enableWordTimeOffsets&quot;: True or False, # If `true`, the top result includes a list of words and
103 # the start and end time offsets (timestamps) for those words. If
104 # `false`, no word-level time offset information is returned. The default is
105 # `false`.
106 &quot;diarizationConfig&quot;: { # Config to enable speaker diarization. # Config to enable speaker diarization and set additional
107 # parameters to make diarization better suited for your application.
108 # Note: When this is enabled, we send all the words from the beginning of the
109 # audio for the top alternative in every consecutive STREAMING responses.
110 # This is done in order to improve our speaker tags as our models learn to
111 # identify the speakers in the conversation over time.
112 # For non-streaming requests, the diarization results will be provided only
113 # in the top alternative of the FINAL SpeechRecognitionResult.
114 &quot;minSpeakerCount&quot;: 42, # Minimum number of speakers in the conversation. This range gives you more
115 # flexibility by allowing the system to automatically determine the correct
116 # number of speakers. If not set, the default value is 2.
117 &quot;maxSpeakerCount&quot;: 42, # Maximum number of speakers in the conversation. This range gives you more
118 # flexibility by allowing the system to automatically determine the correct
119 # number of speakers. If not set, the default value is 6.
120 &quot;speakerTag&quot;: 42, # Output only. Unused.
121 &quot;enableSpeakerDiarization&quot;: True or False, # If &#x27;true&#x27;, enables speaker detection for each recognized word in
122 # the top alternative of the recognition result using a speaker_tag provided
123 # in the WordInfo.
124 },
125 &quot;languageCode&quot;: &quot;A String&quot;, # Required. The language of the supplied audio as a
126 # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
127 # Example: &quot;en-US&quot;.
128 # See [Language
129 # Support](https://cloud.google.com/speech-to-text/docs/languages) for a list
130 # of the currently supported language codes.
131 &quot;profanityFilter&quot;: True or False, # If set to `true`, the server will attempt to filter out
132 # profanities, replacing all but the initial character in each filtered word
133 # with asterisks, e.g. &quot;f***&quot;. If set to `false` or omitted, profanities
134 # won&#x27;t be filtered out.
135 &quot;useEnhanced&quot;: True or False, # Set to true to use an enhanced model for speech recognition.
136 # If `use_enhanced` is set to true and the `model` field is not set, then
137 # an appropriate enhanced model is chosen if an enhanced model exists for
138 # the audio.
139 #
140 # If `use_enhanced` is true and an enhanced version of the specified model
141 # does not exist, then the speech is recognized using the standard version
142 # of the specified model.
143 &quot;metadata&quot;: { # Description of audio data to be recognized. # Metadata regarding this request.
144 &quot;originalMediaType&quot;: &quot;A String&quot;, # The original media the speech was recorded on.
145 &quot;recordingDeviceType&quot;: &quot;A String&quot;, # The type of device the speech was recorded with.
146 &quot;interactionType&quot;: &quot;A String&quot;, # The use case most closely describing the audio content to be recognized.
147 &quot;audioTopic&quot;: &quot;A String&quot;, # Description of the content. Eg. &quot;Recordings of federal supreme court
148 # hearings from 2012&quot;.
149 &quot;originalMimeType&quot;: &quot;A String&quot;, # Mime type of the original audio file. For example `audio/m4a`,
150 # `audio/x-alaw-basic`, `audio/mp3`, `audio/3gpp`.
151 # A list of possible audio mime types is maintained at
152 # http://www.iana.org/assignments/media-types/media-types.xhtml#audio
153 &quot;recordingDeviceName&quot;: &quot;A String&quot;, # The device used to make the recording. Examples &#x27;Nexus 5X&#x27; or
154 # &#x27;Polycom SoundStation IP 6000&#x27; or &#x27;POTS&#x27; or &#x27;VoIP&#x27; or
155 # &#x27;Cardioid Microphone&#x27;.
156 &quot;industryNaicsCodeOfAudio&quot;: 42, # The industry vertical to which this speech recognition request most
157 # closely applies. This is most indicative of the topics contained
158 # in the audio. Use the 6-digit NAICS code to identify the industry
159 # vertical - see https://www.naics.com/search/.
160 &quot;microphoneDistance&quot;: &quot;A String&quot;, # The audio type that most closely describes the audio being recognized.
161 },
162 &quot;sampleRateHertz&quot;: 42, # Sample rate in Hertz of the audio data sent in all
163 # `RecognitionAudio` messages. Valid values are: 8000-48000.
164 # 16000 is optimal. For best results, set the sampling rate of the audio
165 # source to 16000 Hz. If that&#x27;s not possible, use the native sample rate of
166 # the audio source (instead of re-sampling).
167 # This field is optional for FLAC and WAV audio files, but is
168 # required for all other audio formats. For details, see AudioEncoding.
Bu Sun Kim65020912020-05-20 12:08:20 -0700169 &quot;enableSeparateRecognitionPerChannel&quot;: 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 -0700170 # to get each channel recognized separately. The recognition result will
171 # contain a `channel_tag` field to state which channel that result belongs
172 # to. If this is not true, we will only recognize the first channel. The
173 # request is billed cumulatively for all channels recognized:
174 # `audio_channel_count` multiplied by the length of the audio.
Bu Sun Kim65020912020-05-20 12:08:20 -0700175 &quot;enableAutomaticPunctuation&quot;: True or False, # If &#x27;true&#x27;, adds punctuation to recognition result hypotheses.
176 # This feature is only available in select languages. Setting this for
177 # requests in other languages has no effect at all.
178 # The default &#x27;false&#x27; value does not add punctuation to result hypotheses.
179 &quot;maxAlternatives&quot;: 42, # Maximum number of recognition hypotheses to be returned.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400180 # Specifically, the maximum number of `SpeechRecognitionAlternative` messages
181 # within each `SpeechRecognitionResult`.
182 # The server may return fewer than `max_alternatives`.
183 # Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
184 # one. If omitted, will return a maximum of one.
Bu Sun Kim65020912020-05-20 12:08:20 -0700185 &quot;speechContexts&quot;: [ # Array of SpeechContext.
186 # A means to provide context to assist the speech recognition. For more
187 # information, see
188 # [speech
189 # adaptation](https://cloud.google.com/speech-to-text/docs/context-strength).
190 { # Provides &quot;hints&quot; to the speech recognizer to favor specific words and phrases
191 # in the results.
192 &quot;phrases&quot;: [ # A list of strings containing words and phrases &quot;hints&quot; so that
193 # the speech recognition is more likely to recognize them. This can be used
194 # to improve the accuracy for specific words and phrases, for example, if
195 # specific commands are typically spoken by the user. This can also be used
196 # to add additional words to the vocabulary of the recognizer. See
197 # [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
198 #
199 # List items can also be set to classes for groups of words that represent
200 # common concepts that occur in natural language. For example, rather than
201 # providing phrase hints for every month of the year, using the $MONTH class
202 # improves the likelihood of correctly transcribing audio that includes
203 # months.
204 &quot;A String&quot;,
205 ],
206 },
207 ],
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700208 &quot;encoding&quot;: &quot;A String&quot;, # Encoding of audio data sent in all `RecognitionAudio` messages.
209 # This field is optional for `FLAC` and `WAV` audio files and required
210 # for all other audio formats. For details, see AudioEncoding.
Bu Sun Kim65020912020-05-20 12:08:20 -0700211 &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 -0700212 # best suited to your domain to get best results. If a model is not
213 # explicitly specified, then we auto-select a model based on the parameters
214 # in the RecognitionConfig.
Dan O'Mearadd494642020-05-01 07:42:23 -0700215 # &lt;table&gt;
216 # &lt;tr&gt;
217 # &lt;td&gt;&lt;b&gt;Model&lt;/b&gt;&lt;/td&gt;
218 # &lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;
219 # &lt;/tr&gt;
220 # &lt;tr&gt;
221 # &lt;td&gt;&lt;code&gt;command_and_search&lt;/code&gt;&lt;/td&gt;
222 # &lt;td&gt;Best for short queries such as voice commands or voice search.&lt;/td&gt;
223 # &lt;/tr&gt;
224 # &lt;tr&gt;
225 # &lt;td&gt;&lt;code&gt;phone_call&lt;/code&gt;&lt;/td&gt;
226 # &lt;td&gt;Best for audio that originated from a phone call (typically
227 # recorded at an 8khz sampling rate).&lt;/td&gt;
228 # &lt;/tr&gt;
229 # &lt;tr&gt;
230 # &lt;td&gt;&lt;code&gt;video&lt;/code&gt;&lt;/td&gt;
231 # &lt;td&gt;Best for audio that originated from from video or includes multiple
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700232 # speakers. Ideally the audio is recorded at a 16khz or greater
233 # sampling rate. This is a premium model that costs more than the
Dan O'Mearadd494642020-05-01 07:42:23 -0700234 # standard rate.&lt;/td&gt;
235 # &lt;/tr&gt;
236 # &lt;tr&gt;
237 # &lt;td&gt;&lt;code&gt;default&lt;/code&gt;&lt;/td&gt;
238 # &lt;td&gt;Best for audio that is not one of the specific audio models.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700239 # For example, long-form audio. Ideally the audio is high-fidelity,
Dan O'Mearadd494642020-05-01 07:42:23 -0700240 # recorded at a 16khz or greater sampling rate.&lt;/td&gt;
241 # &lt;/tr&gt;
242 # &lt;/table&gt;
Bu Sun Kim65020912020-05-20 12:08:20 -0700243 &quot;audioChannelCount&quot;: 42, # The number of channels in the input audio data.
244 # ONLY set this for MULTI-CHANNEL recognition.
245 # Valid values for LINEAR16 and FLAC are `1`-`8`.
246 # Valid values for OGG_OPUS are &#x27;1&#x27;-&#x27;254&#x27;.
247 # Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only `1`.
248 # If `0` or omitted, defaults to one channel (mono).
249 # Note: We only recognize the first channel by default.
250 # To perform independent recognition on each channel set
251 # `enable_separate_recognition_per_channel` to &#x27;true&#x27;.
Bu Sun Kim65020912020-05-20 12:08:20 -0700252 },
253 &quot;audio&quot;: { # Contains audio data in the encoding specified in the `RecognitionConfig`. # Required. The audio data to be recognized.
254 # Either `content` or `uri` must be supplied. Supplying both or neither
255 # returns google.rpc.Code.INVALID_ARGUMENT. See
256 # [content limits](https://cloud.google.com/speech-to-text/quotas#content).
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700257 &quot;content&quot;: &quot;A String&quot;, # The audio data bytes encoded as specified in
258 # `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
259 # pure binary representation, whereas JSON representations use base64.
Bu Sun Kim65020912020-05-20 12:08:20 -0700260 &quot;uri&quot;: &quot;A String&quot;, # URI that points to a file that contains audio data bytes as specified in
261 # `RecognitionConfig`. The file must not be compressed (for example, gzip).
262 # Currently, only Google Cloud Storage URIs are
263 # supported, which must be specified in the following format:
264 # `gs://bucket_name/object_name` (other URI formats return
265 # google.rpc.Code.INVALID_ARGUMENT). For more information, see
266 # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
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 Kim65020912020-05-20 12:08:20 -0700290 &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 -0400291 # originally returns it. If you use the default HTTP mapping, the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700292 # `name` should be a resource name ending with `operations/{unique_id}`.
Bu Sun Kim65020912020-05-20 12:08:20 -0700293 &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.
294 # different programming environments, including REST APIs and RPC APIs. It is
295 # used by [gRPC](https://github.com/grpc). Each `Status` message contains
296 # three pieces of data: error code, error message, and error details.
297 #
298 # You can find out more about this error model and how to work with it in the
299 # [API Design Guide](https://cloud.google.com/apis/design/errors).
300 &quot;details&quot;: [ # A list of messages that carry the error details. There is a common set of
301 # message types for APIs to use.
302 {
303 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
304 },
305 ],
306 &quot;code&quot;: 42, # The status code, which should be an enum value of google.rpc.Code.
307 &quot;message&quot;: &quot;A String&quot;, # A developer-facing error message, which should be in English. Any
308 # user-facing error message should be localized and sent in the
309 # google.rpc.Status.details field, or localized by the client.
310 },
311 &quot;metadata&quot;: { # Service-specific metadata associated with the operation. It typically
312 # contains progress information and common metadata such as create time.
313 # Some services might not provide such metadata. Any method that returns a
314 # long-running operation should document the metadata type, if any.
315 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
316 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700317 &quot;done&quot;: True or False, # If the value is `false`, it means the operation is still in progress.
318 # If `true`, the operation is completed, and either `error` or `response` is
319 # available.
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 Kim4ed7d3f2020-05-27 12:20:54 -0700336 &quot;enableWordTimeOffsets&quot;: True or False, # If `true`, the top result includes a list of words and
337 # the start and end time offsets (timestamps) for those words. If
338 # `false`, no word-level time offset information is returned. The default is
339 # `false`.
340 &quot;diarizationConfig&quot;: { # Config to enable speaker diarization. # Config to enable speaker diarization and set additional
341 # parameters to make diarization better suited for your application.
342 # Note: When this is enabled, we send all the words from the beginning of the
343 # audio for the top alternative in every consecutive STREAMING responses.
344 # This is done in order to improve our speaker tags as our models learn to
345 # identify the speakers in the conversation over time.
346 # For non-streaming requests, the diarization results will be provided only
347 # in the top alternative of the FINAL SpeechRecognitionResult.
348 &quot;minSpeakerCount&quot;: 42, # Minimum number of speakers in the conversation. This range gives you more
349 # flexibility by allowing the system to automatically determine the correct
350 # number of speakers. If not set, the default value is 2.
351 &quot;maxSpeakerCount&quot;: 42, # Maximum number of speakers in the conversation. This range gives you more
352 # flexibility by allowing the system to automatically determine the correct
353 # number of speakers. If not set, the default value is 6.
354 &quot;speakerTag&quot;: 42, # Output only. Unused.
355 &quot;enableSpeakerDiarization&quot;: True or False, # If &#x27;true&#x27;, enables speaker detection for each recognized word in
356 # the top alternative of the recognition result using a speaker_tag provided
357 # in the WordInfo.
358 },
359 &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;profanityFilter&quot;: True or False, # If set to `true`, the server will attempt to filter out
366 # profanities, replacing all but the initial character in each filtered word
367 # with asterisks, e.g. &quot;f***&quot;. If set to `false` or omitted, profanities
368 # won&#x27;t be filtered out.
369 &quot;useEnhanced&quot;: True or False, # Set to true to use an enhanced model for speech recognition.
370 # If `use_enhanced` is set to true and the `model` field is not set, then
371 # an appropriate enhanced model is chosen if an enhanced model exists for
372 # the audio.
373 #
374 # If `use_enhanced` is true and an enhanced version of the specified model
375 # does not exist, then the speech is recognized using the standard version
376 # of the specified model.
377 &quot;metadata&quot;: { # Description of audio data to be recognized. # Metadata regarding this request.
378 &quot;originalMediaType&quot;: &quot;A String&quot;, # The original media the speech was recorded on.
379 &quot;recordingDeviceType&quot;: &quot;A String&quot;, # The type of device the speech was recorded with.
380 &quot;interactionType&quot;: &quot;A String&quot;, # The use case most closely describing the audio content to be recognized.
381 &quot;audioTopic&quot;: &quot;A String&quot;, # Description of the content. Eg. &quot;Recordings of federal supreme court
382 # hearings from 2012&quot;.
383 &quot;originalMimeType&quot;: &quot;A String&quot;, # Mime type of the original audio file. For example `audio/m4a`,
384 # `audio/x-alaw-basic`, `audio/mp3`, `audio/3gpp`.
385 # A list of possible audio mime types is maintained at
386 # http://www.iana.org/assignments/media-types/media-types.xhtml#audio
387 &quot;recordingDeviceName&quot;: &quot;A String&quot;, # The device used to make the recording. Examples &#x27;Nexus 5X&#x27; or
388 # &#x27;Polycom SoundStation IP 6000&#x27; or &#x27;POTS&#x27; or &#x27;VoIP&#x27; or
389 # &#x27;Cardioid Microphone&#x27;.
390 &quot;industryNaicsCodeOfAudio&quot;: 42, # The industry vertical to which this speech recognition request most
391 # closely applies. This is most indicative of the topics contained
392 # in the audio. Use the 6-digit NAICS code to identify the industry
393 # vertical - see https://www.naics.com/search/.
394 &quot;microphoneDistance&quot;: &quot;A String&quot;, # The audio type that most closely describes the audio being recognized.
395 },
396 &quot;sampleRateHertz&quot;: 42, # Sample rate in Hertz of the audio data sent in all
397 # `RecognitionAudio` messages. Valid values are: 8000-48000.
398 # 16000 is optimal. For best results, set the sampling rate of the audio
399 # source to 16000 Hz. If that&#x27;s not possible, use the native sample rate of
400 # the audio source (instead of re-sampling).
401 # This field is optional for FLAC and WAV audio files, but is
402 # required for all other audio formats. For details, see AudioEncoding.
Bu Sun Kim65020912020-05-20 12:08:20 -0700403 &quot;enableSeparateRecognitionPerChannel&quot;: 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 -0700404 # to get each channel recognized separately. The recognition result will
405 # contain a `channel_tag` field to state which channel that result belongs
406 # to. If this is not true, we will only recognize the first channel. The
407 # request is billed cumulatively for all channels recognized:
408 # `audio_channel_count` multiplied by the length of the audio.
Bu Sun Kim65020912020-05-20 12:08:20 -0700409 &quot;enableAutomaticPunctuation&quot;: True or False, # If &#x27;true&#x27;, adds punctuation to recognition result hypotheses.
410 # This feature is only available in select languages. Setting this for
411 # requests in other languages has no effect at all.
412 # The default &#x27;false&#x27; value does not add punctuation to result hypotheses.
413 &quot;maxAlternatives&quot;: 42, # Maximum number of recognition hypotheses to be returned.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400414 # Specifically, the maximum number of `SpeechRecognitionAlternative` messages
415 # within each `SpeechRecognitionResult`.
416 # The server may return fewer than `max_alternatives`.
417 # Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
418 # one. If omitted, will return a maximum of one.
Bu Sun Kim65020912020-05-20 12:08:20 -0700419 &quot;speechContexts&quot;: [ # Array of SpeechContext.
420 # A means to provide context to assist the speech recognition. For more
421 # information, see
422 # [speech
423 # adaptation](https://cloud.google.com/speech-to-text/docs/context-strength).
424 { # Provides &quot;hints&quot; to the speech recognizer to favor specific words and phrases
425 # in the results.
426 &quot;phrases&quot;: [ # A list of strings containing words and phrases &quot;hints&quot; so that
427 # the speech recognition is more likely to recognize them. This can be used
428 # to improve the accuracy for specific words and phrases, for example, if
429 # specific commands are typically spoken by the user. This can also be used
430 # to add additional words to the vocabulary of the recognizer. See
431 # [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
432 #
433 # List items can also be set to classes for groups of words that represent
434 # common concepts that occur in natural language. For example, rather than
435 # providing phrase hints for every month of the year, using the $MONTH class
436 # improves the likelihood of correctly transcribing audio that includes
437 # months.
438 &quot;A String&quot;,
439 ],
440 },
441 ],
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700442 &quot;encoding&quot;: &quot;A String&quot;, # Encoding of audio data sent in all `RecognitionAudio` messages.
443 # This field is optional for `FLAC` and `WAV` audio files and required
444 # for all other audio formats. For details, see AudioEncoding.
Bu Sun Kim65020912020-05-20 12:08:20 -0700445 &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 -0700446 # best suited to your domain to get best results. If a model is not
447 # explicitly specified, then we auto-select a model based on the parameters
448 # in the RecognitionConfig.
Dan O'Mearadd494642020-05-01 07:42:23 -0700449 # &lt;table&gt;
450 # &lt;tr&gt;
451 # &lt;td&gt;&lt;b&gt;Model&lt;/b&gt;&lt;/td&gt;
452 # &lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;
453 # &lt;/tr&gt;
454 # &lt;tr&gt;
455 # &lt;td&gt;&lt;code&gt;command_and_search&lt;/code&gt;&lt;/td&gt;
456 # &lt;td&gt;Best for short queries such as voice commands or voice search.&lt;/td&gt;
457 # &lt;/tr&gt;
458 # &lt;tr&gt;
459 # &lt;td&gt;&lt;code&gt;phone_call&lt;/code&gt;&lt;/td&gt;
460 # &lt;td&gt;Best for audio that originated from a phone call (typically
461 # recorded at an 8khz sampling rate).&lt;/td&gt;
462 # &lt;/tr&gt;
463 # &lt;tr&gt;
464 # &lt;td&gt;&lt;code&gt;video&lt;/code&gt;&lt;/td&gt;
465 # &lt;td&gt;Best for audio that originated from from video or includes multiple
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700466 # speakers. Ideally the audio is recorded at a 16khz or greater
467 # sampling rate. This is a premium model that costs more than the
Dan O'Mearadd494642020-05-01 07:42:23 -0700468 # standard rate.&lt;/td&gt;
469 # &lt;/tr&gt;
470 # &lt;tr&gt;
471 # &lt;td&gt;&lt;code&gt;default&lt;/code&gt;&lt;/td&gt;
472 # &lt;td&gt;Best for audio that is not one of the specific audio models.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700473 # For example, long-form audio. Ideally the audio is high-fidelity,
Dan O'Mearadd494642020-05-01 07:42:23 -0700474 # recorded at a 16khz or greater sampling rate.&lt;/td&gt;
475 # &lt;/tr&gt;
476 # &lt;/table&gt;
Bu Sun Kim65020912020-05-20 12:08:20 -0700477 &quot;audioChannelCount&quot;: 42, # The number of channels in the input audio data.
478 # ONLY set this for MULTI-CHANNEL recognition.
479 # Valid values for LINEAR16 and FLAC are `1`-`8`.
480 # Valid values for OGG_OPUS are &#x27;1&#x27;-&#x27;254&#x27;.
481 # Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only `1`.
482 # If `0` or omitted, defaults to one channel (mono).
483 # Note: We only recognize the first channel by default.
484 # To perform independent recognition on each channel set
485 # `enable_separate_recognition_per_channel` to &#x27;true&#x27;.
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).
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700491 &quot;content&quot;: &quot;A String&quot;, # The audio data bytes encoded as specified in
492 # `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
493 # pure binary representation, whereas JSON representations use base64.
Bu Sun Kim65020912020-05-20 12:08:20 -0700494 &quot;uri&quot;: &quot;A String&quot;, # URI that points to a file that contains audio data bytes as specified in
495 # `RecognitionConfig`. The file must not be compressed (for example, gzip).
496 # Currently, only Google Cloud Storage URIs are
497 # supported, which must be specified in the following format:
498 # `gs://bucket_name/object_name` (other URI formats return
499 # google.rpc.Code.INVALID_ARGUMENT). For more information, see
500 # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
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 Kim65020912020-05-20 12:08:20 -0700526 &quot;confidence&quot;: 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.
Bu Sun Kim65020912020-05-20 12:08:20 -0700533 &quot;transcript&quot;: &quot;A String&quot;, # Transcript text representing the words that the user spoke.
534 &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 Kim65020912020-05-20 12:08:20 -0700538 &quot;endTime&quot;: &quot;A String&quot;, # 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.
Bu Sun Kim65020912020-05-20 12:08:20 -0700544 &quot;startTime&quot;: &quot;A String&quot;, # Time offset relative to the beginning of the audio,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700545 # and corresponding to the start of the spoken word.
546 # This field is only set if `enable_word_time_offsets=true` and only
547 # in the top hypothesis.
548 # This is an experimental feature and the accuracy of the time offset can
549 # vary.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700550 &quot;word&quot;: &quot;A String&quot;, # The word corresponding to this set of information.
551 &quot;speakerTag&quot;: 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 &#x27;1&#x27; to diarization_speaker_count.
554 # speaker_tag is set if enable_speaker_diarization = &#x27;true&#x27; 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 ],
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400560 },
561 ],
562 }</pre>
563</div>
564
565</body></html>