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