You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sends audio and returns transcription results for recognition requests over a WebSocket connection. Requests and responses are enabled over a single TCP connection that abstracts much of the complexity of the request to offer efficient implementation, low latency, high throughput, and an asynchronous response. By default, only final results are returned for any request; to enable interim results, set the interim_results parameter to true.
63
+
#### Recognize audio
64
+
###### Streaming mode
65
+
66
+
For requests to transcribe live audio as it becomes available or to transcribe multiple audio files with multipart requests, you must set the Transfer-Encoding header to chunked to use streaming mode. In streaming mode, the server closes the connection (status code 408) if the service receives no data chunk for 30 seconds and the service has no audio to transcribe for 30 seconds. The server also closes the connection (status code 400) if no speech is detected for inactivity_timeout seconds of audio (not processing time); use the inactivity_timeout parameter to change the default of 30 seconds.
67
+
68
+
###### Non-multipart requests
69
+
For non-multipart requests, you specify all parameters of the request as a collection of request headers and query parameters, and you provide the audio as the body of the request. This is the recommended means of submitting a recognition request. Use the following parameters:
For multipart requests, you specify a few parameters of the request as request headers and query parameters, but you specify most parameters as multipart form data in the form of JSON metadata, in which only part_content_type is required. You then specify the audio files for the request as subsequent parts of the form data. Use this approach with browsers that do not support JavaScript or when the parameters of the request are greater than the 8 KB limit imposed by most HTTP servers and proxies. Use the following parameters:
77
+
78
+
* Required: Content-Type, metadata, and upload
79
+
* Optional: Transfer-Encoding, model, and customization_id
80
+
81
+
An example of the multipart metadata for a pair of FLAC files follows. This first part of the request is sent as JSON; the remaining parts are the audio files for the request.
65
82
66
-
The service imposes a data size limit of 100 MB per connection. It automatically detects the endianness of the incoming audio and, for audio that includes multiple channels, downmixes the audio to one-channel mono during transcoding.
Note about the Try It Out feature: The Try it out! button is not supported for use with the the POST /v1/recognize method. For examples of calls to the method, see the [Speech to Text API reference][speech-to-text].
69
88
70
-
#### Recognize audio via file
71
-
Sends audio and returns transcription results for a sessionless recognition request. Returns only the final results.
72
89
```cs
73
90
// open and read an audio file
74
91
using (FileStreamfs=File.OpenRead("<path-to-audio-file>"))
75
92
{
76
-
// get a transcript of the audio file
93
+
// get a transcript of the audio file.
77
94
varresults=_speechToText.Recognize(fs);
78
95
}
79
-
```
80
96
81
-
<!-- #### Recognize audio via files
82
-
Sends audio and returns transcription results for a sessionless recognition request submitted as multipart form data. Returns only the final results.
83
-
```cs
84
-
``` -->
97
+
98
+
```
85
99
86
100
#### Create a session
87
101
Creates a session and locks recognition requests to that engine. You can use the session for multiple recognition requests so that each request is processed with the same engine. The session expires after 30 seconds of inactivity. Use the Get status method to prevent the session from expiring.
@@ -97,20 +111,46 @@ Checks whether a specified session can accept another recognition request. Concu
Requests results for a recognition task within a specified session. You can submit this method multiple times for the same recognition task. To see interim results, set the interim_results parameter to true. The request must pass the cookie that was returned by the Create a session method.
Sends audio and returns transcription results for a session-based recognition request. By default, returns only the final transcription results for the request. To see interim results, set the parameter interim_results to true in a call to the Observe result method.
Sends audio and returns transcription results for a session-based recognition request submitted as multipart form data. By default, returns only the final transcription results for the request.
112
148
```cs
113
-
``` -->
149
+
using (FileStreamfs=File.OpenRead("<path-to-audio-file>"))
Deletes an existing session and its engine. The request must pass the cookie that was returned by the Create a session method. You cannot send requests to a session after it is deleted. By default, a session expires after 30 seconds of inactivity if you do not delete it first.
@@ -119,118 +159,149 @@ Deletes an existing session and its engine. The request must pass the cookie tha
119
159
_speechToText.DeleteSession("<session-id>");
120
160
```
121
161
122
-
<!-- #### Register a callback
123
-
Registers a callback URL with the service for use with subsequent asynchronous recognition requests. The service attempts to register, or white-list, the callback URL if it is not already registered by sending a GET request to the callback URL. The service passes a random alphanumeric challenge string via the challenge_string query parameter of the request.
124
-
```cs
125
-
``` -->
126
-
127
-
<!-- #### Create a job
128
-
Creates a job for a new asynchronous recognition request. The job is owned by the user whose service credentials are used to create it. How you learn the status and results of a job depends on the parameters you include with the job creation request:
129
-
130
-
* By callback notification: Include the callback_url query parameter to specify a URL to which the service is to send callback notifications when the status of the job changes. Optionally, you can also include the events and user_token query parameters to subscribe to specific events and to specify a string that is to be included with each notification for the job.
131
-
132
-
* By polling the service: Omit the callback_url, events, and user_token query parameters. You must then use the Check jobs or Check a job method to check the status of the job, using the latter to retrieve the results when the job is complete.
133
-
134
-
```cs
135
-
``` -->
136
-
137
-
<!-- #### Check jobs
138
-
Returns the status and ID of all outstanding jobs associated with the service credentials with which it is called. The method also returns the creation and update times of each job, and, if a job was created with a callback URL and a user token, the user token for the job. To obtain the results for a job whose status is completed, use the Check a job method. A job and its results remain available until you delete them with the Delete a job method or until the job's time to live expires, whichever comes first.
139
-
```cs
140
-
``` -->
141
-
142
-
<!-- #### Check a job
143
-
Returns information about a specified job. The response always includes the status of the job and its creation and update times. If the status is completed, the response also includes the results of the recognition request. You must submit the request with the service credentials of the user who created the job.
144
-
```cs
145
-
``` -->
146
-
147
-
<!-- #### Delete a job
148
-
Deletes the specified job. You cannot delete a job that the service is actively processing. Once you delete a job, its results are no longer available. The service automatically deletes a job and its results when the time to live for the results expires. You must submit the request with the service credentials of the user who created the job.
149
-
```cs
150
-
``` -->
151
-
152
-
<!-- #### Create a custom model
162
+
#### Create a custom model
153
163
Creates a new custom language model for a specified base language model. The custom language model can be used only with the base language model for which it is created. The new model is owned by the individual whose service credentials are used to create it.
Lists information about all custom language models that are owned by the calling user. Use the language query parameter to see all custom models for the specified language; omit the parameter to see all custom models for all languages.
159
170
```cs
160
-
``` -->
171
+
varresult=_speechToText.ListCustomModels();
172
+
```
161
173
162
-
<!--#### List a custom model
174
+
#### List a custom model
163
175
Lists information about a custom language model. Only the owner of a custom model can use this method to query information about the model.
Initiates the training of a custom language model with new corpora, words, or both. After adding training data to the custom model with the corpora or words methods, use this method to begin the actual training of the model on the new data. You can specify whether the custom model is to be trained with all words from its words resources or only with words that were added or modified by the user. Only the owner of a custom model can use this method to train the model.
Resets a custom language model by removing all corpora and words from the model. Resetting a custom model initializes the model to its state when it was first created. Metadata such as the name and language of the model are preserved. Only the owner of a custom model can use this method to reset the model.
Upgrades a custom language model to the latest release level of the Speech to Text service. The method bases the upgrade on the latest trained data stored for the custom model. If the corpora or words for the model have changed since the model was last trained, you must use the Train a custom model method to train the model on the new data. Only the owner of a custom model can use this method to upgrade the model.
179
194
180
195
Note: This method is not currently implemented. It will be added for a future release of the API.
Deletes an existing custom language model. The custom model cannot be deleted if another request, such as adding a corpus to the model, is currently being processed. Only the owner of a custom model can use this method to delete the model.
Adds a single corpus text file of new training data to the custom language model. Use multiple requests to submit multiple corpus text files. Only the owner of a custom model can use this method to add a corpus to the model. Note that adding a corpus does not affect the custom model until you train the model for the new data by using the Train a custom model method.
191
208
```cs
192
-
``` -->
209
+
using (FileStreamfs=File.OpenRead("<path-to-corpus-file>"))
Lists information about all corpora that have been added to the specified custom language model. The information includes the total number of words and out-of-vocabulary (OOV) words, name, and status of each corpus. Only the owner of a custom model can use this method to list the model's corpora.
Lists information about a single specified corpus. The information includes the total number of words and out-of-vocabulary (OOV) words, name, and status of the corpus. Only the owner of a custom model can use this method to list information about a corpus from the model.
Deletes an existing corpus from a custom language model. The service removes any out-of-vocabulary (OOV) words associated with the corpus from the custom model's words resource unless they were also added by another corpus or they have been modified in some way with the Add custom words or Add a custom word method. Removing a corpus does not affect the custom model until you train the model with the Train a custom model method. Only the owner of a custom model can use this method to delete a corpus from the model.
Adds one or more custom words to a custom language model. The service populates the words resource for a custom model with out-of-vocabulary (OOV) words found in each corpus added to the model. You can use this method to add additional words or to modify existing words in the words resource. Only the owner of a custom model can use this method to add or modify custom words associated with the model. Adding or modifying custom words does not affect the custom model until you train the model for the new data by using the Train a custom model method.
Adds a custom word to a custom language model. The service populates the words resource for a custom model with out-of-vocabulary (OOV) words found in each corpus added to the model. You can use this method to add additional words or to modify existing words in the words resource. Only the owner of a custom model can use this method to add or modify a custom word for the model. Adding or modifying a custom word does not affect the custom model until you train the model for the new data by using the Train a custom model method.
Lists information about all custom words from a custom language model. You can list all words from the custom model's words resource, only custom words that were added or modified by the user, or only OOV words that were extracted from corpora. Only the owner of a custom model can use this method to query the words from the model.
Lists information about a custom word from a custom language model. Only the owner of a custom model can use this method to query a word from the model.
Deletes a custom word from a custom language model. You can remove any word that you added to the custom model's words resource via any means. However, if the word also exists in the service's base vocabulary, the service removes only the custom pronunciation for the word; the word remains in the base vocabulary.
231
301
232
302
Removing a custom word does not affect the custom model until you train the model with the Train a custom model method. Only the owner of a custom model can use this method to delete a word from the model.
0 commit comments