blob: 628ebbccdce194e389633e5c042f2e4aa04b5f91 [file] [log] [blame]
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -07001<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
75<h1><a href="speech_v1beta1.html">Google Cloud Speech API</a> . <a href="speech_v1beta1.speech.html">speech</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78 <code><a href="#asyncrecognize">asyncrecognize(body, x__xgafv=None)</a></code></p>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080079<p class="firstline">Performs asynchronous speech recognition: receive results via the</p>
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -070080<p class="toc_element">
81 <code><a href="#syncrecognize">syncrecognize(body, x__xgafv=None)</a></code></p>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080082<p class="firstline">Performs synchronous speech recognition: receive results after all audio</p>
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -070083<h3>Method Details</h3>
84<div class="method">
85 <code class="details" id="asyncrecognize">asyncrecognize(body, x__xgafv=None)</code>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080086 <pre>Performs asynchronous speech recognition: receive results via the
87[google.longrunning.Operations]
88(/speech/reference/rest/v1beta1/operations#Operation)
89interface. Returns either an
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -070090`Operation.error` or an `Operation.response` which contains
91an `AsyncRecognizeResponse` message.
92
93Args:
94 body: object, The request body. (required)
95 The object takes the form of:
96
97{ # `AsyncRecognizeRequest` is the top-level message sent by the client for
98 # the `AsyncRecognize` method.
99 "audio": { # 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 # [audio limits](https://cloud.google.com/speech/limits#content).
103 "content": "A String", # The audio data bytes encoded as specified in
104 # `RecognitionConfig`. Note: as with all bytes fields, protobuffers use a
105 # pure binary representation, whereas JSON representations use base64.
106 "uri": "A String", # URI that points to a file that contains audio data bytes as specified in
107 # `RecognitionConfig`. Currently, only Google Cloud Storage URIs are
108 # supported, which must be specified in the following format:
109 # `gs://bucket_name/object_name` (other URI formats return
110 # google.rpc.Code.INVALID_ARGUMENT). For more information, see
111 # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
112 },
113 "config": { # The `RecognitionConfig` message provides information to the recognizer # [Required] The `config` message provides information to the recognizer
114 # that specifies how to process the request.
115 # that specifies how to process the request.
116 "languageCode": "A String", # [Optional] The language of the supplied audio as a BCP-47 language tag.
117 # Example: "en-GB" https://www.rfc-editor.org/rfc/bcp/bcp47.txt
118 # If omitted, defaults to "en-US". See
Sai Cheemalapatiea3a5e12016-10-12 14:05:53 -0700119 # [Language Support](https://cloud.google.com/speech/docs/languages)
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700120 # for a list of the currently supported language codes.
121 "speechContext": { # Provides "hints" to the speech recognizer to favor specific words and phrases # [Optional] A means to provide context to assist the speech recognition.
122 # in the results.
123 "phrases": [ # [Optional] A list of strings containing words and phrases "hints" so that
124 # the speech recognition is more likely to recognize them. This can be used
125 # to improve the accuracy for specific words and phrases, for example, if
126 # specific commands are typically spoken by the user. This can also be used
127 # to add additional words to the vocabulary of the recognizer. See
128 # [usage limits](https://cloud.google.com/speech/limits#content).
129 "A String",
130 ],
131 },
132 "encoding": "A String", # [Required] Encoding of audio data sent in all `RecognitionAudio` messages.
133 "maxAlternatives": 42, # [Optional] Maximum number of recognition hypotheses to be returned.
134 # Specifically, the maximum number of `SpeechRecognitionAlternative` messages
135 # within each `SpeechRecognitionResult`.
136 # The server may return fewer than `max_alternatives`.
137 # Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
138 # `1`. If omitted, defaults to `1`.
139 "profanityFilter": True or False, # [Optional] If set to `true`, the server will attempt to filter out
140 # profanities, replacing all but the initial character in each filtered word
141 # with asterisks, e.g. "f***". If set to `false` or omitted, profanities
142 # won't be filtered out.
143 "sampleRate": 42, # [Required] Sample rate in Hertz of the audio data sent in all
144 # `RecognitionAudio` messages. Valid values are: 8000-48000.
145 # 16000 is optimal. For best results, set the sampling rate of the audio
146 # source to 16000 Hz. If that's not possible, use the native sample rate of
147 # the audio source (instead of re-sampling).
148 },
149 }
150
151 x__xgafv: string, V1 error format.
152 Allowed values
153 1 - v1 error format
154 2 - v2 error format
155
156Returns:
157 An object of the form:
158
159 { # This resource represents a long-running operation that is the result of a
160 # network API call.
161 "metadata": { # Service-specific metadata associated with the operation. It typically
162 # contains progress information and common metadata such as create time.
163 # Some services might not provide such metadata. Any method that returns a
164 # long-running operation should document the metadata type, if any.
165 "a_key": "", # Properties of the object. Contains field @type with type URL.
166 },
167 "done": True or False, # If the value is `false`, it means the operation is still in progress.
168 # If true, the operation is completed, and either `error` or `response` is
169 # available.
170 "response": { # The normal response of the operation in case of success. If the original
171 # method returns no data on success, such as `Delete`, the response is
172 # `google.protobuf.Empty`. If the original method is standard
173 # `Get`/`Create`/`Update`, the response should be the resource. For other
174 # methods, the response should have the type `XxxResponse`, where `Xxx`
175 # is the original method name. For example, if the original method name
176 # is `TakeSnapshot()`, the inferred response type is
177 # `TakeSnapshotResponse`.
178 "a_key": "", # Properties of the object. Contains field @type with type URL.
179 },
180 "name": "A String", # The server-assigned name, which is only unique within the same service that
181 # originally returns it. If you use the default HTTP mapping, the
182 # `name` should have the format of `operations/some/unique/name`.
Sai Cheemalapatiea3a5e12016-10-12 14:05:53 -0700183 "error": { # The `Status` type defines a logical error model that is suitable for different # The error result of the operation in case of failure or cancellation.
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700184 # programming environments, including REST APIs and RPC APIs. It is used by
185 # [gRPC](https://github.com/grpc). The error model is designed to be:
186 #
187 # - Simple to use and understand for most users
188 # - Flexible enough to meet unexpected needs
189 #
190 # # Overview
191 #
192 # The `Status` message contains three pieces of data: error code, error message,
193 # and error details. The error code should be an enum value of
194 # google.rpc.Code, but it may accept additional error codes if needed. The
195 # error message should be a developer-facing English message that helps
196 # developers *understand* and *resolve* the error. If a localized user-facing
197 # error message is needed, put the localized message in the error details or
198 # localize it in the client. The optional error details may contain arbitrary
199 # information about the error. There is a predefined set of error detail types
200 # in the package `google.rpc` which can be used for common error conditions.
201 #
202 # # Language mapping
203 #
204 # The `Status` message is the logical representation of the error model, but it
205 # is not necessarily the actual wire format. When the `Status` message is
206 # exposed in different client libraries and different wire protocols, it can be
207 # mapped differently. For example, it will likely be mapped to some exceptions
208 # in Java, but more likely mapped to some error codes in C.
209 #
210 # # Other uses
211 #
212 # The error model and the `Status` message can be used in a variety of
213 # environments, either with or without APIs, to provide a
214 # consistent developer experience across different environments.
215 #
216 # Example uses of this error model include:
217 #
218 # - Partial errors. If a service needs to return partial errors to the client,
219 # it may embed the `Status` in the normal response to indicate the partial
220 # errors.
221 #
222 # - Workflow errors. A typical workflow has multiple steps. Each step may
223 # have a `Status` message for error reporting purpose.
224 #
225 # - Batch operations. If a client uses batch request and batch response, the
226 # `Status` message should be used directly inside batch response, one for
227 # each error sub-response.
228 #
229 # - Asynchronous operations. If an API call embeds asynchronous operation
230 # results in its response, the status of those operations should be
231 # represented directly using the `Status` message.
232 #
233 # - Logging. If some API errors are stored in logs, the message `Status` could
234 # be used directly after any stripping needed for security/privacy reasons.
235 "message": "A String", # A developer-facing error message, which should be in English. Any
236 # user-facing error message should be localized and sent in the
237 # google.rpc.Status.details field, or localized by the client.
238 "code": 42, # The status code, which should be an enum value of google.rpc.Code.
239 "details": [ # A list of messages that carry the error details. There will be a
240 # common set of message types for APIs to use.
241 {
242 "a_key": "", # Properties of the object. Contains field @type with type URL.
243 },
244 ],
245 },
246 }</pre>
247</div>
248
249<div class="method">
250 <code class="details" id="syncrecognize">syncrecognize(body, x__xgafv=None)</code>
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800251 <pre>Performs synchronous speech recognition: receive results after all audio
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700252has been sent and processed.
253
254Args:
255 body: object, The request body. (required)
256 The object takes the form of:
257
258{ # `SyncRecognizeRequest` is the top-level message sent by the client for
259 # the `SyncRecognize` method.
260 "audio": { # Contains audio data in the encoding specified in the `RecognitionConfig`. # [Required] The audio data to be recognized.
261 # Either `content` or `uri` must be supplied. Supplying both or neither
262 # returns google.rpc.Code.INVALID_ARGUMENT. See
263 # [audio limits](https://cloud.google.com/speech/limits#content).
264 "content": "A String", # The audio data bytes encoded as specified in
265 # `RecognitionConfig`. Note: as with all bytes fields, protobuffers use a
266 # pure binary representation, whereas JSON representations use base64.
267 "uri": "A String", # URI that points to a file that contains audio data bytes as specified in
268 # `RecognitionConfig`. Currently, only Google Cloud Storage URIs are
269 # supported, which must be specified in the following format:
270 # `gs://bucket_name/object_name` (other URI formats return
271 # google.rpc.Code.INVALID_ARGUMENT). For more information, see
272 # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
273 },
274 "config": { # The `RecognitionConfig` message provides information to the recognizer # [Required] The `config` message provides information to the recognizer
275 # that specifies how to process the request.
276 # that specifies how to process the request.
277 "languageCode": "A String", # [Optional] The language of the supplied audio as a BCP-47 language tag.
278 # Example: "en-GB" https://www.rfc-editor.org/rfc/bcp/bcp47.txt
279 # If omitted, defaults to "en-US". See
Sai Cheemalapatiea3a5e12016-10-12 14:05:53 -0700280 # [Language Support](https://cloud.google.com/speech/docs/languages)
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700281 # for a list of the currently supported language codes.
282 "speechContext": { # Provides "hints" to the speech recognizer to favor specific words and phrases # [Optional] A means to provide context to assist the speech recognition.
283 # in the results.
284 "phrases": [ # [Optional] A list of strings containing words and phrases "hints" so that
285 # the speech recognition is more likely to recognize them. This can be used
286 # to improve the accuracy for specific words and phrases, for example, if
287 # specific commands are typically spoken by the user. This can also be used
288 # to add additional words to the vocabulary of the recognizer. See
289 # [usage limits](https://cloud.google.com/speech/limits#content).
290 "A String",
291 ],
292 },
293 "encoding": "A String", # [Required] Encoding of audio data sent in all `RecognitionAudio` messages.
294 "maxAlternatives": 42, # [Optional] Maximum number of recognition hypotheses to be returned.
295 # Specifically, the maximum number of `SpeechRecognitionAlternative` messages
296 # within each `SpeechRecognitionResult`.
297 # The server may return fewer than `max_alternatives`.
298 # Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
299 # `1`. If omitted, defaults to `1`.
300 "profanityFilter": True or False, # [Optional] If set to `true`, the server will attempt to filter out
301 # profanities, replacing all but the initial character in each filtered word
302 # with asterisks, e.g. "f***". If set to `false` or omitted, profanities
303 # won't be filtered out.
304 "sampleRate": 42, # [Required] Sample rate in Hertz of the audio data sent in all
305 # `RecognitionAudio` messages. Valid values are: 8000-48000.
306 # 16000 is optimal. For best results, set the sampling rate of the audio
307 # source to 16000 Hz. If that's not possible, use the native sample rate of
308 # the audio source (instead of re-sampling).
309 },
310 }
311
312 x__xgafv: string, V1 error format.
313 Allowed values
314 1 - v1 error format
315 2 - v2 error format
316
317Returns:
318 An object of the form:
319
320 { # `SyncRecognizeResponse` is the only message returned to the client by
321 # `SyncRecognize`. It contains the result as zero or more sequential
322 # `SpeechRecognitionResult` messages.
323 "results": [ # [Output-only] Sequential list of transcription results corresponding to
324 # sequential portions of audio.
325 { # A speech recognition result corresponding to a portion of the audio.
326 "alternatives": [ # [Output-only] May contain one or more recognition hypotheses (up to the
327 # maximum specified in `max_alternatives`).
328 { # Alternative hypotheses (a.k.a. n-best list).
329 "confidence": 3.14, # [Output-only] The confidence estimate between 0.0 and 1.0. A higher number
330 # means the system is more confident that the recognition is correct.
331 # This field is typically provided only for the top hypothesis, and only for
332 # `is_final=true` results.
333 # The default of 0.0 is a sentinel value indicating confidence was not set.
334 "transcript": "A String", # [Output-only] Transcript text representing the words that the user spoke.
335 },
336 ],
337 },
338 ],
339 }</pre>
340</div>
341
342</body></html>