blob: cfa98c7c3b16c10b022ab4d7bfaeaa3bb36b3c2e [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 Kim65020912020-05-20 12:08:20 -0700102 &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 -0700103 # to get each channel recognized separately. The recognition result will
104 # contain a `channel_tag` field to state which channel that result belongs
105 # to. If this is not true, we will only recognize the first channel. The
106 # request is billed cumulatively for all channels recognized:
107 # `audio_channel_count` multiplied by the length of the audio.
Bu Sun Kim65020912020-05-20 12:08:20 -0700108 &quot;enableAutomaticPunctuation&quot;: True or False, # If &#x27;true&#x27;, adds punctuation to recognition result hypotheses.
109 # This feature is only available in select languages. Setting this for
110 # requests in other languages has no effect at all.
111 # The default &#x27;false&#x27; value does not add punctuation to result hypotheses.
112 &quot;maxAlternatives&quot;: 42, # Maximum number of recognition hypotheses to be returned.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400113 # Specifically, the maximum number of `SpeechRecognitionAlternative` messages
114 # within each `SpeechRecognitionResult`.
115 # The server may return fewer than `max_alternatives`.
116 # Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
117 # one. If omitted, will return a maximum of one.
Bu Sun Kim65020912020-05-20 12:08:20 -0700118 &quot;encoding&quot;: &quot;A String&quot;, # Encoding of audio data sent in all `RecognitionAudio` messages.
119 # This field is optional for `FLAC` and `WAV` audio files and required
120 # for all other audio formats. For details, see AudioEncoding.
121 &quot;speechContexts&quot;: [ # Array of SpeechContext.
122 # A means to provide context to assist the speech recognition. For more
123 # information, see
124 # [speech
125 # adaptation](https://cloud.google.com/speech-to-text/docs/context-strength).
126 { # Provides &quot;hints&quot; to the speech recognizer to favor specific words and phrases
127 # in the results.
128 &quot;phrases&quot;: [ # A list of strings containing words and phrases &quot;hints&quot; so that
129 # the speech recognition is more likely to recognize them. This can be used
130 # to improve the accuracy for specific words and phrases, for example, if
131 # specific commands are typically spoken by the user. This can also be used
132 # to add additional words to the vocabulary of the recognizer. See
133 # [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
134 #
135 # List items can also be set to classes for groups of words that represent
136 # common concepts that occur in natural language. For example, rather than
137 # providing phrase hints for every month of the year, using the $MONTH class
138 # improves the likelihood of correctly transcribing audio that includes
139 # months.
140 &quot;A String&quot;,
141 ],
142 },
143 ],
144 &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 -0700145 # best suited to your domain to get best results. If a model is not
146 # explicitly specified, then we auto-select a model based on the parameters
147 # in the RecognitionConfig.
Dan O'Mearadd494642020-05-01 07:42:23 -0700148 # &lt;table&gt;
149 # &lt;tr&gt;
150 # &lt;td&gt;&lt;b&gt;Model&lt;/b&gt;&lt;/td&gt;
151 # &lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;
152 # &lt;/tr&gt;
153 # &lt;tr&gt;
154 # &lt;td&gt;&lt;code&gt;command_and_search&lt;/code&gt;&lt;/td&gt;
155 # &lt;td&gt;Best for short queries such as voice commands or voice search.&lt;/td&gt;
156 # &lt;/tr&gt;
157 # &lt;tr&gt;
158 # &lt;td&gt;&lt;code&gt;phone_call&lt;/code&gt;&lt;/td&gt;
159 # &lt;td&gt;Best for audio that originated from a phone call (typically
160 # recorded at an 8khz sampling rate).&lt;/td&gt;
161 # &lt;/tr&gt;
162 # &lt;tr&gt;
163 # &lt;td&gt;&lt;code&gt;video&lt;/code&gt;&lt;/td&gt;
164 # &lt;td&gt;Best for audio that originated from from video or includes multiple
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700165 # speakers. Ideally the audio is recorded at a 16khz or greater
166 # sampling rate. This is a premium model that costs more than the
Dan O'Mearadd494642020-05-01 07:42:23 -0700167 # standard rate.&lt;/td&gt;
168 # &lt;/tr&gt;
169 # &lt;tr&gt;
170 # &lt;td&gt;&lt;code&gt;default&lt;/code&gt;&lt;/td&gt;
171 # &lt;td&gt;Best for audio that is not one of the specific audio models.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700172 # For example, long-form audio. Ideally the audio is high-fidelity,
Dan O'Mearadd494642020-05-01 07:42:23 -0700173 # recorded at a 16khz or greater sampling rate.&lt;/td&gt;
174 # &lt;/tr&gt;
175 # &lt;/table&gt;
Bu Sun Kim65020912020-05-20 12:08:20 -0700176 &quot;audioChannelCount&quot;: 42, # The number of channels in the input audio data.
177 # ONLY set this for MULTI-CHANNEL recognition.
178 # Valid values for LINEAR16 and FLAC are `1`-`8`.
179 # Valid values for OGG_OPUS are &#x27;1&#x27;-&#x27;254&#x27;.
180 # Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only `1`.
181 # If `0` or omitted, defaults to one channel (mono).
182 # Note: We only recognize the first channel by default.
183 # To perform independent recognition on each channel set
184 # `enable_separate_recognition_per_channel` to &#x27;true&#x27;.
185 &quot;diarizationConfig&quot;: { # Config to enable speaker diarization. # Config to enable speaker diarization and set additional
Dan O'Mearadd494642020-05-01 07:42:23 -0700186 # parameters to make diarization better suited for your application.
187 # Note: When this is enabled, we send all the words from the beginning of the
188 # audio for the top alternative in every consecutive STREAMING responses.
189 # This is done in order to improve our speaker tags as our models learn to
190 # identify the speakers in the conversation over time.
191 # For non-streaming requests, the diarization results will be provided only
192 # in the top alternative of the FINAL SpeechRecognitionResult.
Bu Sun Kim65020912020-05-20 12:08:20 -0700193 &quot;minSpeakerCount&quot;: 42, # Minimum number of speakers in the conversation. This range gives you more
Dan O'Mearadd494642020-05-01 07:42:23 -0700194 # flexibility by allowing the system to automatically determine the correct
195 # number of speakers. If not set, the default value is 2.
Bu Sun Kim65020912020-05-20 12:08:20 -0700196 &quot;maxSpeakerCount&quot;: 42, # Maximum number of speakers in the conversation. This range gives you more
Dan O'Mearadd494642020-05-01 07:42:23 -0700197 # flexibility by allowing the system to automatically determine the correct
198 # number of speakers. If not set, the default value is 6.
Bu Sun Kim65020912020-05-20 12:08:20 -0700199 &quot;speakerTag&quot;: 42, # Output only. Unused.
200 &quot;enableSpeakerDiarization&quot;: True or False, # If &#x27;true&#x27;, enables speaker detection for each recognized word in
201 # the top alternative of the recognition result using a speaker_tag provided
202 # in the WordInfo.
Dan O'Mearadd494642020-05-01 07:42:23 -0700203 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700204 &quot;enableWordTimeOffsets&quot;: True or False, # If `true`, the top result includes a list of words and
205 # the start and end time offsets (timestamps) for those words. If
206 # `false`, no word-level time offset information is returned. The default is
207 # `false`.
208 &quot;languageCode&quot;: &quot;A String&quot;, # Required. The language of the supplied audio as a
209 # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
210 # Example: &quot;en-US&quot;.
211 # See [Language
212 # Support](https://cloud.google.com/speech-to-text/docs/languages) for a list
213 # of the currently supported language codes.
214 &quot;profanityFilter&quot;: True or False, # If set to `true`, the server will attempt to filter out
215 # profanities, replacing all but the initial character in each filtered word
216 # with asterisks, e.g. &quot;f***&quot;. If set to `false` or omitted, profanities
217 # won&#x27;t be filtered out.
218 &quot;useEnhanced&quot;: True or False, # Set to true to use an enhanced model for speech recognition.
219 # If `use_enhanced` is set to true and the `model` field is not set, then
220 # an appropriate enhanced model is chosen if an enhanced model exists for
221 # the audio.
222 #
223 # If `use_enhanced` is true and an enhanced version of the specified model
224 # does not exist, then the speech is recognized using the standard version
225 # of the specified model.
226 &quot;metadata&quot;: { # Description of audio data to be recognized. # Metadata regarding this request.
227 &quot;recordingDeviceName&quot;: &quot;A String&quot;, # The device used to make the recording. Examples &#x27;Nexus 5X&#x27; or
228 # &#x27;Polycom SoundStation IP 6000&#x27; or &#x27;POTS&#x27; or &#x27;VoIP&#x27; or
229 # &#x27;Cardioid Microphone&#x27;.
230 &quot;audioTopic&quot;: &quot;A String&quot;, # Description of the content. Eg. &quot;Recordings of federal supreme court
231 # hearings from 2012&quot;.
232 &quot;originalMimeType&quot;: &quot;A String&quot;, # Mime type of the original audio file. For example `audio/m4a`,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700233 # `audio/x-alaw-basic`, `audio/mp3`, `audio/3gpp`.
234 # A list of possible audio mime types is maintained at
235 # http://www.iana.org/assignments/media-types/media-types.xhtml#audio
Bu Sun Kim65020912020-05-20 12:08:20 -0700236 &quot;microphoneDistance&quot;: &quot;A String&quot;, # The audio type that most closely describes the audio being recognized.
237 &quot;industryNaicsCodeOfAudio&quot;: 42, # The industry vertical to which this speech recognition request most
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700238 # closely applies. This is most indicative of the topics contained
239 # in the audio. Use the 6-digit NAICS code to identify the industry
240 # vertical - see https://www.naics.com/search/.
Bu Sun Kim65020912020-05-20 12:08:20 -0700241 &quot;originalMediaType&quot;: &quot;A String&quot;, # The original media the speech was recorded on.
242 &quot;recordingDeviceType&quot;: &quot;A String&quot;, # The type of device the speech was recorded with.
243 &quot;interactionType&quot;: &quot;A String&quot;, # The use case most closely describing the audio content to be recognized.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700244 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700245 &quot;sampleRateHertz&quot;: 42, # Sample rate in Hertz of the audio data sent in all
246 # `RecognitionAudio` messages. Valid values are: 8000-48000.
247 # 16000 is optimal. For best results, set the sampling rate of the audio
248 # source to 16000 Hz. If that&#x27;s not possible, use the native sample rate of
249 # the audio source (instead of re-sampling).
250 # This field is optional for FLAC and WAV audio files, but is
251 # required for all other audio formats. For details, see AudioEncoding.
252 },
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).
257 &quot;uri&quot;: &quot;A String&quot;, # URI that points to a file that contains audio data bytes as specified in
258 # `RecognitionConfig`. The file must not be compressed (for example, gzip).
259 # Currently, only Google Cloud Storage URIs are
260 # supported, which must be specified in the following format:
261 # `gs://bucket_name/object_name` (other URI formats return
262 # google.rpc.Code.INVALID_ARGUMENT). For more information, see
263 # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
264 &quot;content&quot;: &quot;A String&quot;, # The audio data bytes encoded as specified in
265 # `RecognitionConfig`. Note: as with all bytes fields, proto buffers use a
266 # pure binary representation, whereas JSON representations use base64.
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;done&quot;: True or False, # If the value is `false`, it means the operation is still in progress.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700281 # If `true`, the operation is completed, and either `error` or `response` is
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400282 # available.
Bu Sun Kim65020912020-05-20 12:08:20 -0700283 &quot;response&quot;: { # The normal response of the operation in case of success. If the original
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400284 # method returns no data on success, such as `Delete`, the response is
285 # `google.protobuf.Empty`. If the original method is standard
286 # `Get`/`Create`/`Update`, the response should be the resource. For other
287 # methods, the response should have the type `XxxResponse`, where `Xxx`
288 # is the original method name. For example, if the original method name
289 # is `TakeSnapshot()`, the inferred response type is
290 # `TakeSnapshotResponse`.
Bu Sun Kim65020912020-05-20 12:08:20 -0700291 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400292 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700293 &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 -0400294 # originally returns it. If you use the default HTTP mapping, the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700295 # `name` should be a resource name ending with `operations/{unique_id}`.
Bu Sun Kim65020912020-05-20 12:08:20 -0700296 &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.
297 # different programming environments, including REST APIs and RPC APIs. It is
298 # used by [gRPC](https://github.com/grpc). Each `Status` message contains
299 # three pieces of data: error code, error message, and error details.
300 #
301 # You can find out more about this error model and how to work with it in the
302 # [API Design Guide](https://cloud.google.com/apis/design/errors).
303 &quot;details&quot;: [ # A list of messages that carry the error details. There is a common set of
304 # message types for APIs to use.
305 {
306 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
307 },
308 ],
309 &quot;code&quot;: 42, # The status code, which should be an enum value of google.rpc.Code.
310 &quot;message&quot;: &quot;A String&quot;, # A developer-facing error message, which should be in English. Any
311 # user-facing error message should be localized and sent in the
312 # google.rpc.Status.details field, or localized by the client.
313 },
314 &quot;metadata&quot;: { # Service-specific metadata associated with the operation. It typically
315 # contains progress information and common metadata such as create time.
316 # Some services might not provide such metadata. Any method that returns a
317 # long-running operation should document the metadata type, if any.
318 &quot;a_key&quot;: &quot;&quot;, # Properties of the object. Contains field @type with type URL.
319 },
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;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 -0700337 # to get each channel recognized separately. The recognition result will
338 # contain a `channel_tag` field to state which channel that result belongs
339 # to. If this is not true, we will only recognize the first channel. The
340 # request is billed cumulatively for all channels recognized:
341 # `audio_channel_count` multiplied by the length of the audio.
Bu Sun Kim65020912020-05-20 12:08:20 -0700342 &quot;enableAutomaticPunctuation&quot;: True or False, # If &#x27;true&#x27;, adds punctuation to recognition result hypotheses.
343 # This feature is only available in select languages. Setting this for
344 # requests in other languages has no effect at all.
345 # The default &#x27;false&#x27; value does not add punctuation to result hypotheses.
346 &quot;maxAlternatives&quot;: 42, # Maximum number of recognition hypotheses to be returned.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400347 # Specifically, the maximum number of `SpeechRecognitionAlternative` messages
348 # within each `SpeechRecognitionResult`.
349 # The server may return fewer than `max_alternatives`.
350 # Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
351 # one. If omitted, will return a maximum of one.
Bu Sun Kim65020912020-05-20 12:08:20 -0700352 &quot;encoding&quot;: &quot;A String&quot;, # Encoding of audio data sent in all `RecognitionAudio` messages.
353 # This field is optional for `FLAC` and `WAV` audio files and required
354 # for all other audio formats. For details, see AudioEncoding.
355 &quot;speechContexts&quot;: [ # Array of SpeechContext.
356 # A means to provide context to assist the speech recognition. For more
357 # information, see
358 # [speech
359 # adaptation](https://cloud.google.com/speech-to-text/docs/context-strength).
360 { # Provides &quot;hints&quot; to the speech recognizer to favor specific words and phrases
361 # in the results.
362 &quot;phrases&quot;: [ # A list of strings containing words and phrases &quot;hints&quot; so that
363 # the speech recognition is more likely to recognize them. This can be used
364 # to improve the accuracy for specific words and phrases, for example, if
365 # specific commands are typically spoken by the user. This can also be used
366 # to add additional words to the vocabulary of the recognizer. See
367 # [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
368 #
369 # List items can also be set to classes for groups of words that represent
370 # common concepts that occur in natural language. For example, rather than
371 # providing phrase hints for every month of the year, using the $MONTH class
372 # improves the likelihood of correctly transcribing audio that includes
373 # months.
374 &quot;A String&quot;,
375 ],
376 },
377 ],
378 &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 -0700379 # best suited to your domain to get best results. If a model is not
380 # explicitly specified, then we auto-select a model based on the parameters
381 # in the RecognitionConfig.
Dan O'Mearadd494642020-05-01 07:42:23 -0700382 # &lt;table&gt;
383 # &lt;tr&gt;
384 # &lt;td&gt;&lt;b&gt;Model&lt;/b&gt;&lt;/td&gt;
385 # &lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;
386 # &lt;/tr&gt;
387 # &lt;tr&gt;
388 # &lt;td&gt;&lt;code&gt;command_and_search&lt;/code&gt;&lt;/td&gt;
389 # &lt;td&gt;Best for short queries such as voice commands or voice search.&lt;/td&gt;
390 # &lt;/tr&gt;
391 # &lt;tr&gt;
392 # &lt;td&gt;&lt;code&gt;phone_call&lt;/code&gt;&lt;/td&gt;
393 # &lt;td&gt;Best for audio that originated from a phone call (typically
394 # recorded at an 8khz sampling rate).&lt;/td&gt;
395 # &lt;/tr&gt;
396 # &lt;tr&gt;
397 # &lt;td&gt;&lt;code&gt;video&lt;/code&gt;&lt;/td&gt;
398 # &lt;td&gt;Best for audio that originated from from video or includes multiple
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700399 # speakers. Ideally the audio is recorded at a 16khz or greater
400 # sampling rate. This is a premium model that costs more than the
Dan O'Mearadd494642020-05-01 07:42:23 -0700401 # standard rate.&lt;/td&gt;
402 # &lt;/tr&gt;
403 # &lt;tr&gt;
404 # &lt;td&gt;&lt;code&gt;default&lt;/code&gt;&lt;/td&gt;
405 # &lt;td&gt;Best for audio that is not one of the specific audio models.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700406 # For example, long-form audio. Ideally the audio is high-fidelity,
Dan O'Mearadd494642020-05-01 07:42:23 -0700407 # recorded at a 16khz or greater sampling rate.&lt;/td&gt;
408 # &lt;/tr&gt;
409 # &lt;/table&gt;
Bu Sun Kim65020912020-05-20 12:08:20 -0700410 &quot;audioChannelCount&quot;: 42, # The number of channels in the input audio data.
411 # ONLY set this for MULTI-CHANNEL recognition.
412 # Valid values for LINEAR16 and FLAC are `1`-`8`.
413 # Valid values for OGG_OPUS are &#x27;1&#x27;-&#x27;254&#x27;.
414 # Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE is only `1`.
415 # If `0` or omitted, defaults to one channel (mono).
416 # Note: We only recognize the first channel by default.
417 # To perform independent recognition on each channel set
418 # `enable_separate_recognition_per_channel` to &#x27;true&#x27;.
419 &quot;diarizationConfig&quot;: { # Config to enable speaker diarization. # Config to enable speaker diarization and set additional
Dan O'Mearadd494642020-05-01 07:42:23 -0700420 # parameters to make diarization better suited for your application.
421 # Note: When this is enabled, we send all the words from the beginning of the
422 # audio for the top alternative in every consecutive STREAMING responses.
423 # This is done in order to improve our speaker tags as our models learn to
424 # identify the speakers in the conversation over time.
425 # For non-streaming requests, the diarization results will be provided only
426 # in the top alternative of the FINAL SpeechRecognitionResult.
Bu Sun Kim65020912020-05-20 12:08:20 -0700427 &quot;minSpeakerCount&quot;: 42, # Minimum number of speakers in the conversation. This range gives you more
Dan O'Mearadd494642020-05-01 07:42:23 -0700428 # flexibility by allowing the system to automatically determine the correct
429 # number of speakers. If not set, the default value is 2.
Bu Sun Kim65020912020-05-20 12:08:20 -0700430 &quot;maxSpeakerCount&quot;: 42, # Maximum number of speakers in the conversation. This range gives you more
Dan O'Mearadd494642020-05-01 07:42:23 -0700431 # flexibility by allowing the system to automatically determine the correct
432 # number of speakers. If not set, the default value is 6.
Bu Sun Kim65020912020-05-20 12:08:20 -0700433 &quot;speakerTag&quot;: 42, # Output only. Unused.
434 &quot;enableSpeakerDiarization&quot;: True or False, # If &#x27;true&#x27;, enables speaker detection for each recognized word in
435 # the top alternative of the recognition result using a speaker_tag provided
436 # in the WordInfo.
Dan O'Mearadd494642020-05-01 07:42:23 -0700437 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700438 &quot;enableWordTimeOffsets&quot;: True or False, # If `true`, the top result includes a list of words and
439 # the start and end time offsets (timestamps) for those words. If
440 # `false`, no word-level time offset information is returned. The default is
441 # `false`.
442 &quot;languageCode&quot;: &quot;A String&quot;, # Required. The language of the supplied audio as a
443 # [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
444 # Example: &quot;en-US&quot;.
445 # See [Language
446 # Support](https://cloud.google.com/speech-to-text/docs/languages) for a list
447 # of the currently supported language codes.
448 &quot;profanityFilter&quot;: True or False, # If set to `true`, the server will attempt to filter out
449 # profanities, replacing all but the initial character in each filtered word
450 # with asterisks, e.g. &quot;f***&quot;. If set to `false` or omitted, profanities
451 # won&#x27;t be filtered out.
452 &quot;useEnhanced&quot;: True or False, # Set to true to use an enhanced model for speech recognition.
453 # If `use_enhanced` is set to true and the `model` field is not set, then
454 # an appropriate enhanced model is chosen if an enhanced model exists for
455 # the audio.
456 #
457 # If `use_enhanced` is true and an enhanced version of the specified model
458 # does not exist, then the speech is recognized using the standard version
459 # of the specified model.
460 &quot;metadata&quot;: { # Description of audio data to be recognized. # Metadata regarding this request.
461 &quot;recordingDeviceName&quot;: &quot;A String&quot;, # The device used to make the recording. Examples &#x27;Nexus 5X&#x27; or
462 # &#x27;Polycom SoundStation IP 6000&#x27; or &#x27;POTS&#x27; or &#x27;VoIP&#x27; or
463 # &#x27;Cardioid Microphone&#x27;.
464 &quot;audioTopic&quot;: &quot;A String&quot;, # Description of the content. Eg. &quot;Recordings of federal supreme court
465 # hearings from 2012&quot;.
466 &quot;originalMimeType&quot;: &quot;A String&quot;, # Mime type of the original audio file. For example `audio/m4a`,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700467 # `audio/x-alaw-basic`, `audio/mp3`, `audio/3gpp`.
468 # A list of possible audio mime types is maintained at
469 # http://www.iana.org/assignments/media-types/media-types.xhtml#audio
Bu Sun Kim65020912020-05-20 12:08:20 -0700470 &quot;microphoneDistance&quot;: &quot;A String&quot;, # The audio type that most closely describes the audio being recognized.
471 &quot;industryNaicsCodeOfAudio&quot;: 42, # The industry vertical to which this speech recognition request most
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700472 # closely applies. This is most indicative of the topics contained
473 # in the audio. Use the 6-digit NAICS code to identify the industry
474 # vertical - see https://www.naics.com/search/.
Bu Sun Kim65020912020-05-20 12:08:20 -0700475 &quot;originalMediaType&quot;: &quot;A String&quot;, # The original media the speech was recorded on.
476 &quot;recordingDeviceType&quot;: &quot;A String&quot;, # The type of device the speech was recorded with.
477 &quot;interactionType&quot;: &quot;A String&quot;, # The use case most closely describing the audio content to be recognized.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700478 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700479 &quot;sampleRateHertz&quot;: 42, # Sample rate in Hertz of the audio data sent in all
480 # `RecognitionAudio` messages. Valid values are: 8000-48000.
481 # 16000 is optimal. For best results, set the sampling rate of the audio
482 # source to 16000 Hz. If that&#x27;s not possible, use the native sample rate of
483 # the audio source (instead of re-sampling).
484 # This field is optional for FLAC and WAV audio files, but is
485 # required for all other audio formats. For details, see AudioEncoding.
486 },
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).
498 &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 Kim65020912020-05-20 12:08:20 -0700518 &quot;alternatives&quot;: [ # May contain one or more recognition hypotheses (up to the
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400519 # maximum specified in `max_alternatives`).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700520 # These alternatives are ordered in terms of accuracy, with the top (first)
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400521 # alternative being the most probable, as ranked by the recognizer.
522 { # Alternative hypotheses (a.k.a. n-best list).
Bu Sun Kim65020912020-05-20 12:08:20 -0700523 &quot;confidence&quot;: 3.14, # The confidence estimate between 0.0 and 1.0. A higher number
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400524 # indicates an estimated greater likelihood that the recognized words are
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700525 # correct. This field is set only for the top alternative of a non-streaming
526 # result or, of a streaming result where `is_final=true`.
527 # This field is not guaranteed to be accurate and users should not rely on it
528 # to be always provided.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400529 # The default of 0.0 is a sentinel value indicating `confidence` was not set.
Bu Sun Kim65020912020-05-20 12:08:20 -0700530 &quot;transcript&quot;: &quot;A String&quot;, # Transcript text representing the words that the user spoke.
531 &quot;words&quot;: [ # A list of word-specific information for each recognized word.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700532 # Note: When `enable_speaker_diarization` is true, you will see all the words
533 # from the beginning of the audio.
534 { # Word-specific information for recognized words.
Bu Sun Kim65020912020-05-20 12:08:20 -0700535 &quot;word&quot;: &quot;A String&quot;, # The word corresponding to this set of information.
536 &quot;speakerTag&quot;: 42, # Output only. A distinct integer value is assigned for every speaker within
537 # the audio. This field specifies which one of those speakers was detected to
538 # have spoken this word. Value ranges from &#x27;1&#x27; to diarization_speaker_count.
539 # speaker_tag is set if enable_speaker_diarization = &#x27;true&#x27; and only in the
540 # top alternative.
541 &quot;endTime&quot;: &quot;A String&quot;, # Time offset relative to the beginning of the audio,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700542 # and corresponding to the end of the spoken word.
543 # This field is only set if `enable_word_time_offsets=true` and only
544 # in the top hypothesis.
545 # This is an experimental feature and the accuracy of the time offset can
546 # vary.
Bu Sun Kim65020912020-05-20 12:08:20 -0700547 &quot;startTime&quot;: &quot;A String&quot;, # Time offset relative to the beginning of the audio,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700548 # and corresponding to the start of the spoken word.
549 # This field is only set if `enable_word_time_offsets=true` and only
550 # in the top hypothesis.
551 # This is an experimental feature and the accuracy of the time offset can
552 # vary.
553 },
554 ],
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400555 },
556 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700557 &quot;channelTag&quot;: 42, # For multi-channel audio, this is the channel number corresponding to the
558 # recognized result for the audio from that channel.
559 # For audio_channel_count = N, its output values can range from &#x27;1&#x27; to &#x27;N&#x27;.
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400560 },
561 ],
562 }</pre>
563</div>
564
565</body></html>