Speech to Text: start task
POST/api/technology/speech-to-text
Start a Speech to Text task for a media file.
Speech to Text features
- Multi-channel audio files are supported.
- Channel id is included in individual transcription segments.
- The built-in vocabulary can be extended using
config
field ofmultipart/form-data
. The value ofconfig
is a string in JSON format.
Fine-tuning the transcription
It is possible to gain finer control over the Speech to Text transcription in two ways. Firstly, you may specify an array of preferred phrases, which will be prioritized in ambiguous cases. Secondly, you can extend the built-in vocabulary by providing an array of additional words. These two options can be used either in tandem or independently.
Preferred phrases
In case of unclear speech, the Speech to Text technology usually prefers word that makes more sense in the given context. For example, it might be impossible to determine whether a speaker said "I'm going to cell my car" or "I'm going to sell my car". However, the context suggests that the speaker is probably talking about selling their car. In other cases though, it might not be as clear. Consider the following sentence: "He bought flour in the shop". In the given context, the flour might very well be flower.
Preferred phrases allow you to leverage your unique knowledge of recording's context and prompt the technology with utterances that are expected to appear in the speech. This is especially helpful for transcribing predictable or domain-specific conversations.
Additional words
You may use this configuration option to specify pronunciation of words that occur in preferred phrases. If the words from preferred phrases don't have explicitly specified pronunciation, one of two things can happen. Either a word is known by the technology's vocabulary and a built-in (and thus precise) pronunciation is used. Or it is an unknown word and the technology does its best to generate a default pronunciation based on the word's written form. Take note that this may result in incorrect pronunciations, especially with words foreign to the recording's language. Therefore, relying on auto-generated pronunciation is discouraged.
Alternatively, this option can be used to extend the technology's built-in vocabulary by new words. This is especially useful for industry-specific terms, foreign words, slang or neologisms. Another use case is adding region- or country-specific pronunciations to otherwise known words. Again, it is not mandatory to provide a pronunciation for new words, but the same limitations as described above apply.
Request
Query Parameters
A string specifying the language for Speech to Text Phonexia. The value should follow RFC 5646. It can consist of the "language", "region", and "privateuse" subtags. Refer to supported languages for a complete list of supported language tags.
Possible values: [split
, mix
]
A string enumeration value representing the channel mode for conversion. This value indicates how the audio channels should be processed during conversion. Only the channels with the specified indices (channels
parameter) will be processed, and others will be ignored.
split
A string of integers separated by comma (without spaces), representing the channels that should be kept during conversion. If specified, only the channels with the specified indices will be processed, and others will be ignored. If empty, all channels in the audio data will be processed. Note that channels
is 0-based.
Header Parameters
Correlation ID is a special type of request ID which is unique over a series of requests and responses, identifying a transaction in a distributed system. Correlation ID will be generated if not provided.
In distributed system architecture (microservices architecture) it is a unique ID of request and response combination throughout all components of a distributed system. Request ID will be generated if not provided.
- multipart/form-data
Bodyrequired
Input media file.
config object
Responses
- 202
- 400
- 403
- 413
- 422
- 429
- 507
Speech to Text task was accepted. Follow the X-Location
header to poll for the task state.
Response Headers
- application/json
- Schema
- Example (auto)
Schema
task objectrequired
{
"task": {
"task_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"state": "pending"
}
}
Request payload data was invalid and could not be parsed.
- application/json
- Schema
- Example (auto)
- request.invalid
Schema
Machine-readable error type.
Possible values: [internal
, resource.not-found
, method.invalid
, request.forbidden
, request.invalid
, request.validation-error
, request.rate-limit-exceeded
, request.size-limit-exceeded
, storage.capacity-exceeded
]
Human-readable summary of the error.
detail object[]
{
"type": "internal",
"message": "string",
"detail": [
{
"location": [
0,
"string"
],
"message": "string",
"type": "string",
"context": {}
}
]
}
Invalid request.
{
"type": "request.invalid",
"message": "Invalid request.",
"detail": []
}
Request is forbidden.
- application/json
- Schema
- Example (auto)
- request.forbidden
Schema
Machine-readable error type.
Possible values: [internal
, resource.not-found
, method.invalid
, request.forbidden
, request.invalid
, request.validation-error
, request.rate-limit-exceeded
, request.size-limit-exceeded
, storage.capacity-exceeded
]
Human-readable summary of the error.
detail object[]
{
"type": "internal",
"message": "string",
"detail": [
{
"location": [
0,
"string"
],
"message": "string",
"type": "string",
"context": {}
}
]
}
Processing capacity allowed for the operation was exceeded.
{
"type": "request.forbidden",
"message": "Request is forbidden.",
"detail": [
{
"location": [
"license"
],
"message": "Licensed processing capacity exceeded.",
"type": "licensing.capacity-exceeded",
"context": {}
}
]
}
The request entity (payload) size exceeds the allowed limit.
- application/json
- Schema
- Example (auto)
- request.size-limit-exceeded
Schema
Machine-readable error type.
Possible values: [internal
, resource.not-found
, method.invalid
, request.forbidden
, request.invalid
, request.validation-error
, request.rate-limit-exceeded
, request.size-limit-exceeded
, storage.capacity-exceeded
]
Human-readable summary of the error.
detail object[]
{
"type": "internal",
"message": "string",
"detail": [
{
"location": [
0,
"string"
],
"message": "string",
"type": "string",
"context": {}
}
]
}
Request size limit exceeded.
{
"type": "request.size-limit-exceeded",
"message": "Request size limit exceeded.",
"detail": [
{
"location": [
"body",
"file"
],
"message": "Input media file too large.",
"type": "media.too-large",
"context": {
"file_size": 1048576000,
"max_file_size": 524288000,
"size_unit": "bytes"
}
}
]
}
Error during validation of request payload data occurred.
- application/json
- Schema
- Example (auto)
- request validation error
Schema
Machine-readable error type.
Possible values: [internal
, resource.not-found
, method.invalid
, request.forbidden
, request.invalid
, request.validation-error
, request.rate-limit-exceeded
, request.size-limit-exceeded
, storage.capacity-exceeded
]
Human-readable summary of the error.
detail object[]
{
"type": "internal",
"message": "string",
"detail": [
{
"location": [
0,
"string"
],
"message": "string",
"type": "string",
"context": {}
}
]
}
Request validation error.
{
"type": "request.validation-error",
"message": "Request validation error.",
"detail": []
}
Request rate limit exceeded.
The request may be retried after a while. The following response headers may be checked for details: retry-after
, x-ratelimit-limit
, x-ratelimit-remaining
, x-ratelimit-reset
.
Response Headers
- application/json
- Schema
- Example (auto)
- request.rate-limit-exceeded
Schema
Machine-readable error type.
Possible values: [internal
, resource.not-found
, method.invalid
, request.forbidden
, request.invalid
, request.validation-error
, request.rate-limit-exceeded
, request.size-limit-exceeded
, storage.capacity-exceeded
]
Human-readable summary of the error.
detail object[]
{
"type": "internal",
"message": "string",
"detail": [
{
"location": [
0,
"string"
],
"message": "string",
"type": "string",
"context": {}
}
]
}
Rate limit exceeded.
{
"type": "request.rate-limit-exceeded",
"message": "Rate limit exceeded: 1 per 5 second.",
"detail": []
}
The storage is full and cannot accept any data.
- application/json
- Schema
- Example (auto)
- insufficient storage
Schema
Machine-readable error type.
Possible values: [internal
, resource.not-found
, method.invalid
, request.forbidden
, request.invalid
, request.validation-error
, request.rate-limit-exceeded
, request.size-limit-exceeded
, storage.capacity-exceeded
]
Human-readable summary of the error.
detail object[]
{
"type": "internal",
"message": "string",
"detail": [
{
"location": [
0,
"string"
],
"message": "string",
"type": "string",
"context": {}
}
]
}
Storage capacity exceeded.
{
"type": "storage.capacity-exceeded",
"message": "Storage capacity exceeded.",
"detail": []
}
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://docs.cloud.phonexia.com/api/technology/speech-to-text");
request.Headers.Add("Accept", "application/json");
var content = new StringContent(string.Empty);
content.Headers.ContentType = new MediaTypeHeaderValue("multipart/form-data");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());