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