List models
GET /v1/models
Lists all language models that are available for use with the service. The information includes the name of the model and its minimum sampling rate in Hertz, among other things. The ordering of the list of models can change from call to call; do not rely on an alphabetized or static list of models.
See also: Listing all models.
Request
Response
200 - OK. The request succeeded.
models
array
An array of `SpeechModel` objects that provides information about each available model.
406 - Not Acceptable. The request specified an `Accept` header with an incompatible content type.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
415 - Unsupported Media Type. The request specified an unacceptable media type.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Get a model
GET /v1/models/{model_id}
Gets information for a single specified language model that is available for use with the service. The information includes the name of the model and its minimum sampling rate in Hertz, among other things.
See also: Listing a specific model.
Request
Path Parameters
model_id
Required *
string
The identifier of the model in the form of its name from the output of the List models method.
Query Parameters
Response
200 - OK. The request succeeded.
name
string
The name of the model for use as an identifier in calls to the service (for example, `en-US_BroadbandModel`).
language
string
The language identifier of the model (for example, `en-US`).
rate
integer
The sampling rate (minimum acceptable rate for audio) used by the model in Hertz.
url
string
The URI for the model.
supported_features
SupportedFeatures
Indicates whether select service features are supported with the model.
description
string
A brief description of the model.
404 - Not Found. The specified `model_id` was not found.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
406 - Not Acceptable. The request specified an `Accept` header with an incompatible content type.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
415 - Unsupported Media Type. The request specified an unacceptable media type.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Streaming mode
For requests to transcribe live audio as it becomes available, you must set the `Transfer-Encoding` header to `chunked` to use streaming mode. In streaming mode, the service closes the connection (status code 408) if it does not receive at least 15 seconds of audio (including silence) in any 30-second period. The service also closes the connection (status code 400) if it detects no speech for `inactivity_timeout` seconds of streaming audio; use the `inactivity_timeout` parameter to change the default of 30 seconds.
See also:
Audio formats (content types)
The service accepts audio in the following formats (MIME types).
- For formats that are labeled Required, you must use the `Content-Type` header with the request to specify the format of the audio.
- For all other formats, you can omit the `Content-Type` header or specify `application/octet-stream` with the header to have the service automatically detect the format of the audio. (With the `curl` command, you can specify either `"Content-Type:"` or `"Content-Type: application/octet-stream"`.)
Where indicated, the format that you specify must include the sampling rate and can optionally include the number of channels and the endianness of the audio.
- `audio/alaw` (Required. Specify the sampling rate (`rate`) of the audio.)
- `audio/basic` (Required. Use only with narrowband models.)
- `audio/flac`
- `audio/g729` (Use only with narrowband models.)
- `audio/l16` (Required. Specify the sampling rate (`rate`) and optionally the number of channels (`channels`) and endianness (`endianness`) of the audio.)
- `audio/mp3`
- `audio/mpeg`
- `audio/mulaw` (Required. Specify the sampling rate (`rate`) of the audio.)
- `audio/ogg` (The service automatically detects the codec of the input audio.)
- `audio/ogg;codecs=opus`
- `audio/ogg;codecs=vorbis`
- `audio/wav` (Provide audio with a maximum of nine channels.)
- `audio/webm` (The service automatically detects the codec of the input audio.)
- `audio/webm;codecs=opus`
- `audio/webm;codecs=vorbis`
The sampling rate of the audio must match the sampling rate of the model for the recognition request: for broadband models, at least 16 kHz; for narrowband models, at least 8 kHz. If the sampling rate of the audio is higher than the minimum required rate, the service down-samples the audio to the appropriate rate. If the sampling rate of the audio is lower than the minimum required rate, the request fails.
See also: Supported audio formats.
Large speech models and Next-generation models
The service supports large speech models and next-generation `Multimedia` (16 kHz) and `Telephony` (8 kHz) models for many languages. Large speech models and next-generation models have higher throughput than the service's previous generation of `Broadband` and `Narrowband` models. When you use large speech models and next-generation models, the service can return transcriptions more quickly and also provide noticeably better transcription accuracy.
You specify a large speech model or next-generation model by using the `model` query parameter, as you do a previous-generation model. Only the next-generation models support the `low_latency` parameter, and all large speech models and next-generation models support the `character_insertion_bias` parameter. These parameters are not available with previous-generation models.
Large speech models and next-generation models do not support all of the speech recognition parameters that are available for use with previous-generation models. Next-generation models do not support the following parameters:
- `acoustic_customization_id`
- `keywords` and `keywords_threshold`
- `processing_metrics` and `processing_metrics_interval`
- `word_alternatives_threshold`
Important: Effective 31 July 2023, all previous-generation models will be removed from the service and the documentation. Most previous-generation models were deprecated on 15 March 2022. You must migrate to the equivalent large speech model or next-generation model by 31 July 2023. For more information, see Migrating to large speech models.
See also:
- Large speech languages and models
- Supported features for large speech models
- Next-generation languages and models
- Supported features for next-generation models
Multipart speech recognition
Note: The asynchronous HTTP interface, WebSocket interface, and Watson SDKs do not support multipart speech recognition.
The HTTP `POST` method of the service also supports multipart speech recognition. With multipart requests, you pass all audio data as multipart form data. You specify some parameters as request headers and query parameters, but you pass JSON metadata as form data to control most aspects of the transcription. You can use multipart recognition to pass multiple audio files with a single request.
Use the multipart approach with browsers for which JavaScript is disabled or when the parameters used with the request are greater than the 8 KB limit imposed by most HTTP servers and proxies. You can encounter this limit, for example, if you want to spot a very large number of keywords.
See also: Making a multipart HTTP request.">
Recognize audio
POST /v1/recognize
Sends audio and returns transcription results for a recognition request. You can pass a maximum of 100 MB and a minimum of 100 bytes of audio with a request. The service automatically detects the endianness of the incoming audio and, for audio that includes multiple channels, downmixes the audio to one-channel mono during transcoding. The method returns only final results; to enable interim results, use the WebSocket API. (With the `curl` command, use the `--data-binary` option to upload the file for the request.)
See also: Making a basic HTTP request.
Streaming mode
For requests to transcribe live audio as it becomes available, you must set the `Transfer-Encoding` header to `chunked` to use streaming mode. In streaming mode, the service closes the connection (status code 408) if it does not receive at least 15 seconds of audio (including silence) in any 30-second period. The service also closes the connection (status code 400) if it detects no speech for `inactivity_timeout` seconds of streaming audio; use the `inactivity_timeout` parameter to change the default of 30 seconds.
See also:
Audio formats (content types)
The service accepts audio in the following formats (MIME types).
- For formats that are labeled Required, you must use the `Content-Type` header with the request to specify the format of the audio.
- For all other formats, you can omit the `Content-Type` header or specify `application/octet-stream` with the header to have the service automatically detect the format of the audio. (With the `curl` command, you can specify either `"Content-Type:"` or `"Content-Type: application/octet-stream"`.)
Where indicated, the format that you specify must include the sampling rate and can optionally include the number of channels and the endianness of the audio.
- `audio/alaw` (Required. Specify the sampling rate (`rate`) of the audio.)
- `audio/basic` (Required. Use only with narrowband models.)
- `audio/flac`
- `audio/g729` (Use only with narrowband models.)
- `audio/l16` (Required. Specify the sampling rate (`rate`) and optionally the number of channels (`channels`) and endianness (`endianness`) of the audio.)
- `audio/mp3`
- `audio/mpeg`
- `audio/mulaw` (Required. Specify the sampling rate (`rate`) of the audio.)
- `audio/ogg` (The service automatically detects the codec of the input audio.)
- `audio/ogg;codecs=opus`
- `audio/ogg;codecs=vorbis`
- `audio/wav` (Provide audio with a maximum of nine channels.)
- `audio/webm` (The service automatically detects the codec of the input audio.)
- `audio/webm;codecs=opus`
- `audio/webm;codecs=vorbis`
The sampling rate of the audio must match the sampling rate of the model for the recognition request: for broadband models, at least 16 kHz; for narrowband models, at least 8 kHz. If the sampling rate of the audio is higher than the minimum required rate, the service down-samples the audio to the appropriate rate. If the sampling rate of the audio is lower than the minimum required rate, the request fails.
See also: Supported audio formats.
Large speech models and Next-generation models
The service supports large speech models and next-generation `Multimedia` (16 kHz) and `Telephony` (8 kHz) models for many languages. Large speech models and next-generation models have higher throughput than the service's previous generation of `Broadband` and `Narrowband` models. When you use large speech models and next-generation models, the service can return transcriptions more quickly and also provide noticeably better transcription accuracy.
You specify a large speech model or next-generation model by using the `model` query parameter, as you do a previous-generation model. Only the next-generation models support the `low_latency` parameter, and all large speech models and next-generation models support the `character_insertion_bias` parameter. These parameters are not available with previous-generation models.
Large speech models and next-generation models do not support all of the speech recognition parameters that are available for use with previous-generation models. Next-generation models do not support the following parameters:
- `acoustic_customization_id`
- `keywords` and `keywords_threshold`
- `processing_metrics` and `processing_metrics_interval`
- `word_alternatives_threshold`
Important: Effective 31 July 2023, all previous-generation models will be removed from the service and the documentation. Most previous-generation models were deprecated on 15 March 2022. You must migrate to the equivalent large speech model or next-generation model by 31 July 2023. For more information, see Migrating to large speech models.
See also:
- Large speech languages and models
- Supported features for large speech models
- Next-generation languages and models
- Supported features for next-generation models
Multipart speech recognition
Note: The asynchronous HTTP interface, WebSocket interface, and Watson SDKs do not support multipart speech recognition.
The HTTP `POST` method of the service also supports multipart speech recognition. With multipart requests, you pass all audio data as multipart form data. You specify some parameters as request headers and query parameters, but you pass JSON metadata as form data to control most aspects of the transcription. You can use multipart recognition to pass multiple audio files with a single request.
Use the multipart approach with browsers for which JavaScript is disabled or when the parameters used with the request are greater than the 8 KB limit imposed by most HTTP servers and proxies. You can encounter this limit, for example, if you want to spot a very large number of keywords.
See also: Making a multipart HTTP request.
Request
Request Body
Path Parameters
Query Parameters
model
string
The model to use for speech recognition. If you omit the `model` parameter, the service uses the US English `en-US_BroadbandModel` by default.
For IBM Cloud Pak for Data, if you do not install the `en-US_BroadbandModel`, you must either specify a model with the request or specify a new default model for your installation of the service.
See also:
speech_begin_event
boolean
If `true`, the service returns a response object `SpeechActivity` which contains the time when a speech activity is detected in the stream. This can be used both in standard and low latency mode. This feature enables client applications to know that some words/speech has been detected and the service is in the process of decoding. This can be used in lieu of interim results in standard mode. Use `sad_module: 2` to increase accuracy and performance in detecting speech boundaries within the audio stream. See Using speech recognition parameters
enrichments
string
Speech transcript enrichment improves readability of raw ASR transcripts by adding punctuation (periods, commas, question marks, exclamation points) and intelligent capitalization (sentence beginnings, proper nouns, acronyms, brand names). To enable enrichment, add the `enrichments=punctuation` parameter to your recognition request. Supported languages include English (US, UK, Australia, India), French (France, Canada), German, Italian, Portuguese (Brazil, Portugal), Spanish (Spain, Latin America, Argentina, Chile, Colombia, Mexico, Peru), and Japanese. See Speech transcript enrichment.
language_customization_id
string
The customization ID (GUID) of a custom language model that is to be used with the recognition request. The base model of the specified custom language model must match the model specified with the `model` parameter. You must make the request with credentials for the instance of the service that owns the custom model. By default, no custom language model is used. See Using a custom language model for speech recognition.
Note: Use this parameter instead of the deprecated `customization_id` parameter.
acoustic_customization_id
string
The customization ID (GUID) of a custom acoustic model that is to be used with the recognition request. The base model of the specified custom acoustic model must match the model specified with the `model` parameter. You must make the request with credentials for the instance of the service that owns the custom model. By default, no custom acoustic model is used. See Using a custom acoustic model for speech recognition.
base_model_version
string
The version of the specified base model that is to be used with the recognition request. Multiple versions of a base model can exist when a model is updated for internal improvements. The parameter is intended primarily for use with custom models that have been upgraded for a new base model. The default value depends on whether the parameter is used with or without a custom model. See Making speech recognition requests with upgraded custom models.
customization_weight
number
If you specify the customization ID (GUID) of a custom language model with the recognition request, the customization weight tells the service how much weight to give to words from the custom language model compared to those from the base model for the current request.
Specify a value between 0.0 and 1.0. Unless a different customization weight was specified for the custom model when the model was trained, the default value is:
- 0.5 for large speech models
- 0.3 for previous-generation models
- 0.2 for most next-generation models
- 0.1 for next-generation English and Japanese models
A customization weight that you specify overrides a weight that was specified when the custom model was trained. The default value yields the best performance in general. Assign a higher value if your audio makes frequent use of OOV words from the custom model. Use caution when setting the weight: a higher value can improve the accuracy of phrases from the custom model's domain, but it can negatively affect performance on non-domain phrases.
See Using customization weight.
inactivity_timeout
integer
The time in seconds after which, if only silence (no speech) is detected in streaming audio, the connection is closed with a 400 error. The parameter is useful for stopping audio submission from a live microphone when a user simply walks away. Use `-1` for infinity. See Inactivity timeout.
keywords
array
An array of keyword strings to spot in the audio. Each keyword string can include one or more string tokens. Keywords are spotted only in the final results, not in interim hypotheses. If you specify any keywords, you must also specify a keywords threshold. Omit the parameter or specify an empty array if you do not need to spot keywords.
You can spot a maximum of 1000 keywords with a single request. A single keyword can have a maximum length of 1024 characters, though the maximum effective length for double-byte languages might be shorter. Keywords are case-insensitive.
See Keyword spotting.
keywords_threshold
number
A confidence value that is the lower bound for spotting a keyword. A word is considered to match a keyword if its confidence is greater than or equal to the threshold. Specify a probability between 0.0 and 1.0. If you specify a threshold, you must also specify one or more keywords. The service performs no keyword spotting if you omit either parameter. See Keyword spotting.
max_alternatives
integer
The maximum number of alternative transcripts that the service is to return. By default, the service returns a single transcript. If you specify a value of `0`, the service uses the default value, `1`. See Maximum alternatives.
word_alternatives_threshold
number
A confidence value that is the lower bound for identifying a hypothesis as a possible word alternative (also known as "Confusion Networks"). An alternative word is considered if its confidence is greater than or equal to the threshold. Specify a probability between 0.0 and 1.0. By default, the service computes no alternative words. See Word alternatives.
word_confidence
boolean
If `true`, the service returns a confidence measure in the range of 0.0 to 1.0 for each word. By default, the service returns no word confidence scores. See Word confidence.
timestamps
boolean
If `true`, the service returns time alignment for each word. By default, no timestamps are returned. See Word timestamps.
profanity_filter
boolean
If `true`, the service filters profanity from all output except for keyword results by replacing inappropriate words with a series of asterisks. Set the parameter to `false` to return results with no censoring.
Note: The parameter can be used with US English and Japanese transcription only. See Profanity filtering.
smart_formatting
boolean
If `true`, the service converts dates, times, series of digits and numbers, phone numbers, currency values, and internet addresses into more readable, conventional representations in the final transcript of a recognition request. For US English, the service also converts certain keyword strings to punctuation symbols. By default, the service performs no smart formatting.
Note: The parameter can be used with US English, Japanese, and Spanish (all dialects) transcription only.
See Smart formatting.
smart_formatting_version
integer
Smart formatting version for large speech models and next-generation models is supported in US English, Brazilian Portuguese, French, German, Spanish and French Canadian languages.
speaker_labels
boolean
If `true`, the response includes labels that identify which words were spoken by which participants in a multi-person exchange. By default, the service returns no speaker labels. Setting `speaker_labels` to `true` forces the `timestamps` parameter to be `true`, regardless of whether you specify `false` for the parameter.
- For previous-generation models, the parameter can be used with Australian English, US English, German, Japanese, Korean, and Spanish (both broadband and narrowband models) and UK English (narrowband model) transcription only.
- For large speech models and next-generation models, the parameter can be used with all available languages.
See Speaker labels.
grammar_name
string
The name of a grammar that is to be used with the recognition request. If you specify a grammar, you must also use the `language_customization_id` parameter to specify the name of the custom language model for which the grammar is defined. The service recognizes only strings that are recognized by the specified grammar; it does not recognize other custom words from the model's words resource.
See Using a grammar for speech recognition.
redaction
boolean
If `true`, the service redacts, or masks, numeric data from final transcripts. The feature redacts any number that has three or more consecutive digits by replacing each digit with an `X` character. It is intended to redact sensitive numeric data, such as credit card numbers. By default, the service performs no redaction.
When you enable redaction, the service automatically enables smart formatting, regardless of whether you explicitly disable that feature. To ensure maximum security, the service also disables keyword spotting (ignores the `keywords` and `keywords_threshold` parameters) and returns only a single final transcript (forces the `max_alternatives` parameter to be `1`).
Note: The parameter can be used with US English, Japanese, and Korean transcription only.
See Numeric redaction.
audio_metrics
boolean
If `true`, requests detailed information about the signal characteristics of the input audio. The service returns audio metrics with the final transcription results. By default, the service returns no audio metrics.
See Audio metrics.
end_of_phrase_silence_time
number
Specifies the duration of the pause interval at which the service splits a transcript into multiple final results. If the service detects pauses or extended silence before it reaches the end of the audio stream, its response can include multiple final results. Silence indicates a point at which the speaker pauses between spoken words or phrases.
Specify a value for the pause interval in the range of 0.0 to 120.0.
- A value greater than 0 specifies the interval that the service is to use for speech recognition.
- A value of 0 indicates that the service is to use the default interval. It is equivalent to omitting the parameter.
The default pause interval for most languages is 0.8 seconds; the default for Chinese is 0.6 seconds.
See End of phrase silence time.
split_transcript_at_phrase_end
boolean
If `true`, directs the service to split the transcript into multiple final results based on semantic features of the input, for example, at the conclusion of meaningful phrases such as sentences. The service bases its understanding of semantic features on the base language model that you use with a request. Custom language models and grammars can also influence how and where the service splits a transcript.
By default, the service splits transcripts based solely on the pause interval. If the parameters are used together on the same request, `end_of_phrase_silence_time` has precedence over `split_transcript_at_phrase_end`.
See Split transcript at phrase end.
speech_detector_sensitivity
number
The sensitivity of speech activity detection that the service is to perform. Use the parameter to suppress word insertions from music, coughing, and other non-speech events. The service biases the audio it passes for speech recognition by evaluating the input audio against prior models of speech and non-speech activity.
Specify a value between 0.0 and 1.0:
- 0.0 suppresses all audio (no speech is transcribed).
- 0.5 (the default) provides a reasonable compromise for the level of sensitivity.
- 1.0 suppresses no audio (speech detection sensitivity is disabled).
The values increase on a monotonic curve. Specifying one or two decimal places of precision (for example, `0.55`) is typically more than sufficient.
The parameter is supported with all large speech models, next-generation models and with most previous-generation models. See Speech detector sensitivity and Language model support.
sad_module
integer
Detects speech boundaries within the audio stream with better performance, improved noise suppression, faster responsiveness, and increased accuracy.
Specify `sad_module: 2`
See Speech Activity Detection (SAD).
background_audio_suppression
number
The level to which the service is to suppress background audio based on its volume to prevent it from being transcribed as speech. Use the parameter to suppress side conversations or background noise.
Specify a value in the range of 0.0 to 1.0:
- 0.0 (the default) provides no suppression (background audio suppression is disabled).
- 0.5 provides a reasonable level of audio suppression for general usage.
- 1.0 suppresses all audio (no audio is transcribed).
The values increase on a monotonic curve. Specifying one or two decimal places of precision (for example, `0.55`) is typically more than sufficient.
The parameter is supported with all large speech models, next-generation models and with most previous-generation models. See Background audio suppression and Language model support.
low_latency
boolean
If `true` for next-generation `Multimedia` and `Telephony` models that support low latency, directs the service to produce results even more quickly than it usually does. Next-generation models produce transcription results faster than previous-generation models. The `low_latency` parameter causes the models to produce results even more quickly, though the results might be less accurate when the parameter is used.
The parameter is not available for large speech models and previous-generation `Broadband` and `Narrowband` models. It is available for most next-generation models.
- For a list of next-generation models that support low latency, see Supported next-generation language models.
- For more information about the `low_latency` parameter, see Low latency.
character_insertion_bias
number
For large speech models and next-generation models, an indication of whether the service is biased to recognize shorter or longer strings of characters when developing transcription hypotheses. By default, the service is optimized to produce the best balance of strings of different lengths.
The default bias is 0.0. The allowable range of values is -1.0 to 1.0.
- Negative values bias the service to favor hypotheses with shorter strings of characters.
- Positive values bias the service to favor hypotheses with longer strings of characters.
As the value approaches -1.0 or 1.0, the impact of the parameter becomes more pronounced. To determine the most effective value for your scenario, start by setting the value of the parameter to a small increment, such as -0.1, -0.05, 0.05, or 0.1, and assess how the value impacts the transcription results. Then experiment with different values as necessary, adjusting the value by small increments.
The parameter is not available for previous-generation models.
Response
200 - OK. The request succeeded.
results
array
An array of `SpeechRecognitionResult` objects that can include interim and final results (interim results are returned only if supported by the method). Final results are guaranteed not to change; interim results might be replaced by further interim results and eventually final results.
For the HTTP interfaces, all results arrive at the same time. For the WebSocket interface, results can be sent as multiple separate responses. The service periodically sends updates to the results list. The `result_index` is incremented to the lowest index in the array that has changed for new results.
For more information, see Understanding speech recognition results.
result_index
integer
An index that indicates a change point in the `results` array. The service increments the index for additional results that it sends for new audio for the same request. All results with the same index are delivered at the same time. The same index can include multiple final results that are delivered with the same response.
speaker_labels
array
An array of `SpeakerLabelsResult` objects that identifies which words were spoken by which speakers in a multi-person exchange. The array is returned only if the `speaker_labels` parameter is `true`. When interim results are also requested for methods that support them, it is possible for a `SpeechRecognitionResults` object to include only the `speaker_labels` field.
processing_metrics
ProcessingMetrics
If processing metrics are requested, information about the service's processing of the input audio. Processing metrics are not available with the synchronous Recognize audio method.
audio_metrics
AudioMetrics
If audio metrics are requested, information about the signal characteristics of the input audio.
warnings
array
An array of warning messages associated with the request:
- Warnings for invalid parameters or fields can include a descriptive message and a list of invalid argument strings, for example, `"Unknown arguments:"` or `"Unknown url query arguments:"` followed by a list of the form `"{invalid_arg_1}, {invalid_arg_2}."` (If you use the `character_insertion_bias` parameter with a previous-generation model, the warning message refers to the parameter as `lambdaBias`.)
- The following warning is returned if the request passes a custom model that is based on an older version of a base model for which an updated version is available: `"Using previous version of base model, because your custom model has been built with it. Please note that this version will be supported only for a limited time. Consider updating your custom model to the new base model. If you do not do that you will be automatically switched to base model when you used the non-updated custom model."`
In both cases, the request succeeds despite the warnings.
enriched_results
EnrichedResults
If enriched results are requested, transcription with inserted punctuation marks such as periods, commas, question marks, and exclamation points.
400 - Bad Request. The request failed because of a user input error. For example, the request passed audio that does not match the indicated format or failed to specify a required audio format; specified a custom language or custom acoustic model that is not in the `available` state; or experienced an inactivity timeout. Specific messages include
- `Model {model} not found`
- `Requested model is not available`
- `This 8000hz audio input requires a narrow band model. See /v1/models for a listp of available models.`
- `speaker_labels is not a supported feature for model {model}`
- `keywords_threshold value must be between zero and one (inclusive)`
- `word_alternatives_threshold value must be between zero and one (inclusive)`
- `You cannot specify both 'customization_id' and 'language_customization_id' parameter!`
- `No speech detected for 30s`
- `Unable to transcode data stream application/octet-stream -> audio/l16`
- `Stream was {number} bytes but needs to be at least 100 bytes.`
- `keyword {keyword} length exceeds the maximum length 1024`
- `low_latency is not a supported feature for model {model}`
- `Character insertion bias must be a value between -1 and 1.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
404 - Not Found. The specified model does not exist or, for IBM Cloud Pak for Data, the `model` parameter was not specified but the default model is not installed. The message is `Model '{model}' not found`.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
406 - Not Acceptable. The request specified an `Accept` header with an incompatible content type.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
408 - Request Timeout. The connection was closed due to inactivity (session timeout) for 30 seconds.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
413 - Payload Too Large. The request passed an audio file that exceeded the currently supported data limit.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
415 - Unsupported Media Type. The request specified an unacceptable media type.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Register a callback
POST /v1/register_callback
Registers a callback URL with the service for use with subsequent asynchronous recognition requests. The service attempts to register, or allowlist, 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` parameter of the request. The request includes an `Accept` header that specifies `text/plain` as the required response type.
To be registered successfully, the callback URL must respond to the `GET` request from the service. The response must send status code 200 and must include the challenge string in its body. Set the `Content-Type` response header to `text/plain`. Upon receiving this response, the service responds to the original registration request with response code 201.
The service sends only a single `GET` request to the callback URL. If the service does not receive a reply with a response code of 200 and a body that echoes the challenge string sent by the service within five seconds, it does not allowlist the URL; it instead sends status code 400 in response to the request to register a callback. If the requested callback URL is already allowlisted, the service responds to the initial registration request with response code 200.
If you specify a user secret with the request, the service uses it as a key to calculate an HMAC-SHA1 signature of the challenge string in its response to the `POST` request. It sends this signature in the `X-Callback-Signature` header of its `GET` request to the URL during registration. It also uses the secret to calculate a signature over the payload of every callback notification that uses the URL. The signature provides authentication and data integrity for HTTP communications.
After you successfully register a callback URL, you can use it with an indefinite number of recognition requests. You can register a maximum of 20 callback URLS in a one-hour span of time.
See also: Registering a callback URL.
Request
Path Parameters
Query Parameters
callback_url
Required *
string
An HTTP or HTTPS URL to which callback notifications are to be sent. To be allowlisted, the URL must successfully echo the challenge string during URL verification. During verification, the client can also check the signature that the service sends in the `X-Callback-Signature` header to verify the origin of the request.
user_secret
string
A user-specified string that the service uses to generate the HMAC-SHA1 signature that it sends via the `X-Callback-Signature` header. The service includes the header during URL verification and with every notification sent to the callback URL. It calculates the signature over the payload of the notification. If you omit the parameter, the service does not send the header.
Response
200 - OK. The callback was already registered (allowlisted). The status included in the response is `already created`.
status
string
The current status of the job:
- `created`: The service successfully allowlisted the callback URL as a result of the call.
- `already created`: The URL was already allowlisted.
url
string
The callback URL that is successfully registered.
201 - Created. The callback was successfully registered (allowlisted). The status included in the response is `created`.
status
string
The current status of the job:
- `created`: The service successfully allowlisted the callback URL as a result of the call.
- `already created`: The URL was already allowlisted.
url
string
The callback URL that is successfully registered.
400 - Bad Request. The callback registration failed. The request was missing a required parameter or specified an invalid argument; the client sent an invalid response to the service's `GET` request during the registration process; or the client failed to respond to the server's request before the five-second timeout.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Unregister a callback
POST /v1/unregister_callback
Unregisters a callback URL that was previously allowlisted with a Register a callback request for use with the asynchronous interface. Once unregistered, the URL can no longer be used with asynchronous recognition requests.
See also: Unregistering a callback URL.
Request
Path Parameters
Query Parameters
callback_url
Required *
string
The callback URL that is to be unregistered.
Response
200 - OK. The callback URL was successfully unregistered.
400 - Bad Request. The request failed because of a user input error (for example, because it failed to pass a callback URL).
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
404 - Not Found. The specified callback URL was not found.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
The method supports the same basic parameters as other HTTP and WebSocket recognition requests. It also supports the following parameters specific to the asynchronous interface:
- `callback_url`
- `events`
- `user_token`
- `results_ttl`
You can pass a maximum of 1 GB and a minimum of 100 bytes of audio with a request. The service automatically detects the endianness of the incoming audio and, for audio that includes multiple channels, downmixes the audio to one-channel mono during transcoding. The method returns only final results; to enable interim results, use the WebSocket API. (With the `curl` command, use the `--data-binary` option to upload the file for the request.)
See also: Creating a job.
Streaming mode
For requests to transcribe live audio as it becomes available, you must set the `Transfer-Encoding` header to `chunked` to use streaming mode. In streaming mode, the service closes the connection (status code 408) if it does not receive at least 15 seconds of audio (including silence) in any 30-second period. The service also closes the connection (status code 400) if it detects no speech for `inactivity_timeout` seconds of streaming audio; use the `inactivity_timeout` parameter to change the default of 30 seconds.
See also:
Audio formats (content types)
The service accepts audio in the following formats (MIME types).
- For formats that are labeled Required, you must use the `Content-Type` header with the request to specify the format of the audio.
- For all other formats, you can omit the `Content-Type` header or specify `application/octet-stream` with the header to have the service automatically detect the format of the audio. (With the `curl` command, you can specify either `"Content-Type:"` or `"Content-Type: application/octet-stream"`.)
Where indicated, the format that you specify must include the sampling rate and can optionally include the number of channels and the endianness of the audio.
- `audio/alaw` (Required. Specify the sampling rate (`rate`) of the audio.)
- `audio/basic` (Required. Use only with narrowband models.)
- `audio/flac`
- `audio/g729` (Use only with narrowband models.)
- `audio/l16` (Required. Specify the sampling rate (`rate`) and optionally the number of channels (`channels`) and endianness (`endianness`) of the audio.)
- `audio/mp3`
- `audio/mpeg`
- `audio/mulaw` (Required. Specify the sampling rate (`rate`) of the audio.)
- `audio/ogg` (The service automatically detects the codec of the input audio.)
- `audio/ogg;codecs=opus`
- `audio/ogg;codecs=vorbis`
- `audio/wav` (Provide audio with a maximum of nine channels.)
- `audio/webm` (The service automatically detects the codec of the input audio.)
- `audio/webm;codecs=opus`
- `audio/webm;codecs=vorbis`
The sampling rate of the audio must match the sampling rate of the model for the recognition request: for broadband models, at least 16 kHz; for narrowband models, at least 8 kHz. If the sampling rate of the audio is higher than the minimum required rate, the service down-samples the audio to the appropriate rate. If the sampling rate of the audio is lower than the minimum required rate, the request fails.
See also: Supported audio formats.
Large speech models and Next-generation models
The service supports large speech models and next-generation `Multimedia` (16 kHz) and `Telephony` (8 kHz) models for many languages. Large speech models and next-generation models have higher throughput than the service's previous generation of `Broadband` and `Narrowband` models. When you use large speech models and next-generation models, the service can return transcriptions more quickly and also provide noticeably better transcription accuracy.
You specify a large speech model or next-generation model by using the `model` query parameter, as you do a previous-generation model. Only the next-generation models support the `low_latency` parameter, and all large speech models and next-generation models support the `character_insertion_bias` parameter. These parameters are not available with previous-generation models.
Large speech models and next-generation models do not support all of the speech recognition parameters that are available for use with previous-generation models. Next-generation models do not support the following parameters:
- `acoustic_customization_id`
- `keywords` and `keywords_threshold`
- `processing_metrics` and `processing_metrics_interval`
- `word_alternatives_threshold`
Important: Effective 31 July 2023, all previous-generation models will be removed from the service and the documentation. Most previous-generation models were deprecated on 15 March 2022. You must migrate to the equivalent large speech model or next-generation model by 31 July 2023. For more information, see Migrating to large speech models.
See also:
- Large speech languages and models
- Supported features for large speech models
- Next-generation languages and models
- Supported features for next-generation models">
Create a job
POST /v1/recognitions
Creates a job for a new asynchronous recognition request. The job is owned by the instance of the service whose 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:
- By callback notification: Include the `callback_url` 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` parameters to subscribe to specific events and to specify a string that is to be included with each notification for the job.
- By polling the service: Omit the `callback_url`, `events`, and `user_token` parameters. You must then use the Check jobs or Check a job methods to check the status of the job, using the latter to retrieve the results when the job is complete.
The two approaches are not mutually exclusive. You can poll the service for job status or obtain results from the service manually even if you include a callback URL. In both cases, you can include the `results_ttl` parameter to specify how long the results are to remain available after the job is complete. Using the HTTPS Check a job method to retrieve results is more secure than receiving them via callback notification over HTTP because it provides confidentiality in addition to authentication and data integrity.
The method supports the same basic parameters as other HTTP and WebSocket recognition requests. It also supports the following parameters specific to the asynchronous interface:
- `callback_url`
- `events`
- `user_token`
- `results_ttl`
You can pass a maximum of 1 GB and a minimum of 100 bytes of audio with a request. The service automatically detects the endianness of the incoming audio and, for audio that includes multiple channels, downmixes the audio to one-channel mono during transcoding. The method returns only final results; to enable interim results, use the WebSocket API. (With the `curl` command, use the `--data-binary` option to upload the file for the request.)
See also: Creating a job.
Streaming mode
For requests to transcribe live audio as it becomes available, you must set the `Transfer-Encoding` header to `chunked` to use streaming mode. In streaming mode, the service closes the connection (status code 408) if it does not receive at least 15 seconds of audio (including silence) in any 30-second period. The service also closes the connection (status code 400) if it detects no speech for `inactivity_timeout` seconds of streaming audio; use the `inactivity_timeout` parameter to change the default of 30 seconds.
See also:
Audio formats (content types)
The service accepts audio in the following formats (MIME types).
- For formats that are labeled Required, you must use the `Content-Type` header with the request to specify the format of the audio.
- For all other formats, you can omit the `Content-Type` header or specify `application/octet-stream` with the header to have the service automatically detect the format of the audio. (With the `curl` command, you can specify either `"Content-Type:"` or `"Content-Type: application/octet-stream"`.)
Where indicated, the format that you specify must include the sampling rate and can optionally include the number of channels and the endianness of the audio.
- `audio/alaw` (Required. Specify the sampling rate (`rate`) of the audio.)
- `audio/basic` (Required. Use only with narrowband models.)
- `audio/flac`
- `audio/g729` (Use only with narrowband models.)
- `audio/l16` (Required. Specify the sampling rate (`rate`) and optionally the number of channels (`channels`) and endianness (`endianness`) of the audio.)
- `audio/mp3`
- `audio/mpeg`
- `audio/mulaw` (Required. Specify the sampling rate (`rate`) of the audio.)
- `audio/ogg` (The service automatically detects the codec of the input audio.)
- `audio/ogg;codecs=opus`
- `audio/ogg;codecs=vorbis`
- `audio/wav` (Provide audio with a maximum of nine channels.)
- `audio/webm` (The service automatically detects the codec of the input audio.)
- `audio/webm;codecs=opus`
- `audio/webm;codecs=vorbis`
The sampling rate of the audio must match the sampling rate of the model for the recognition request: for broadband models, at least 16 kHz; for narrowband models, at least 8 kHz. If the sampling rate of the audio is higher than the minimum required rate, the service down-samples the audio to the appropriate rate. If the sampling rate of the audio is lower than the minimum required rate, the request fails.
See also: Supported audio formats.
Large speech models and Next-generation models
The service supports large speech models and next-generation `Multimedia` (16 kHz) and `Telephony` (8 kHz) models for many languages. Large speech models and next-generation models have higher throughput than the service's previous generation of `Broadband` and `Narrowband` models. When you use large speech models and next-generation models, the service can return transcriptions more quickly and also provide noticeably better transcription accuracy.
You specify a large speech model or next-generation model by using the `model` query parameter, as you do a previous-generation model. Only the next-generation models support the `low_latency` parameter, and all large speech models and next-generation models support the `character_insertion_bias` parameter. These parameters are not available with previous-generation models.
Large speech models and next-generation models do not support all of the speech recognition parameters that are available for use with previous-generation models. Next-generation models do not support the following parameters:
- `acoustic_customization_id`
- `keywords` and `keywords_threshold`
- `processing_metrics` and `processing_metrics_interval`
- `word_alternatives_threshold`
Important: Effective 31 July 2023, all previous-generation models will be removed from the service and the documentation. Most previous-generation models were deprecated on 15 March 2022. You must migrate to the equivalent large speech model or next-generation model by 31 July 2023. For more information, see Migrating to large speech models.
See also:
- Large speech languages and models
- Supported features for large speech models
- Next-generation languages and models
- Supported features for next-generation models
Request
Request Body
Path Parameters
Query Parameters
model
string
The model to use for speech recognition. If you omit the `model` parameter, the service uses the US English `en-US_BroadbandModel` by default.
For IBM Cloud Pak for Data, if you do not install the `en-US_BroadbandModel`, you must either specify a model with the request or specify a new default model for your installation of the service.
See also:
callback_url
string
A URL to which callback notifications are to be sent. The URL must already be successfully allowlisted by using the Register a callback method. You can include the same callback URL with any number of job creation requests. Omit the parameter to poll the service for job completion and results.
Use the `user_token` parameter to specify a unique user-specified string with each job to differentiate the callback notifications for the jobs.
events
string
If the job includes a callback URL, a comma-separated list of notification events to which to subscribe. Valid events are
- `recognitions.started` generates a callback notification when the service begins to process the job.
- `recognitions.completed` generates a callback notification when the job is complete. You must use the Check a job method to retrieve the results before they time out or are deleted.
- `recognitions.completed_with_results` generates a callback notification when the job is complete. The notification includes the results of the request.
- `recognitions.failed` generates a callback notification if the service experiences an error while processing the job.
The `recognitions.completed` and `recognitions.completed_with_results` events are incompatible. You can specify only of the two events.
If the job includes a callback URL, omit the parameter to subscribe to the default events: `recognitions.started`, `recognitions.completed`, and `recognitions.failed`. If the job does not include a callback URL, omit the parameter.
user_token
string
If the job includes a callback URL, a user-specified string that the service is to include with each callback notification for the job; the token allows the user to maintain an internal mapping between jobs and notification events. If the job does not include a callback URL, omit the parameter.
results_ttl
integer
The number of minutes for which the results are to be available after the job has finished. If not delivered via a callback, the results must be retrieved within this time. Omit the parameter to use a time to live of one week. The parameter is valid with or without a callback URL.
speech_begin_event
boolean
If `true`, the service returns a response object `SpeechActivity` which contains the time when a speech activity is detected in the stream. This can be used both in standard and low latency mode. This feature enables client applications to know that some words/speech has been detected and the service is in the process of decoding. This can be used in lieu of interim results in standard mode. Use `sad_module: 2` to increase accuracy and performance in detecting speech boundaries within the audio stream. See Using speech recognition parameters
enrichments
string
Speech transcript enrichment improves readability of raw ASR transcripts by adding punctuation (periods, commas, question marks, exclamation points) and intelligent capitalization (sentence beginnings, proper nouns, acronyms, brand names). To enable enrichment, add the `enrichments=punctuation` parameter to your recognition request. Supported languages include English (US, UK, Australia, India), French (France, Canada), German, Italian, Portuguese (Brazil, Portugal), Spanish (Spain, Latin America, Argentina, Chile, Colombia, Mexico, Peru), and Japanese. See Speech transcript enrichment.
language_customization_id
string
The customization ID (GUID) of a custom language model that is to be used with the recognition request. The base model of the specified custom language model must match the model specified with the `model` parameter. You must make the request with credentials for the instance of the service that owns the custom model. By default, no custom language model is used. See Using a custom language model for speech recognition.
Note: Use this parameter instead of the deprecated `customization_id` parameter.
acoustic_customization_id
string
The customization ID (GUID) of a custom acoustic model that is to be used with the recognition request. The base model of the specified custom acoustic model must match the model specified with the `model` parameter. You must make the request with credentials for the instance of the service that owns the custom model. By default, no custom acoustic model is used. See Using a custom acoustic model for speech recognition.
base_model_version
string
The version of the specified base model that is to be used with the recognition request. Multiple versions of a base model can exist when a model is updated for internal improvements. The parameter is intended primarily for use with custom models that have been upgraded for a new base model. The default value depends on whether the parameter is used with or without a custom model. See Making speech recognition requests with upgraded custom models.
customization_weight
number
If you specify the customization ID (GUID) of a custom language model with the recognition request, the customization weight tells the service how much weight to give to words from the custom language model compared to those from the base model for the current request.
Specify a value between 0.0 and 1.0. Unless a different customization weight was specified for the custom model when the model was trained, the default value is:
- 0.5 for large speech models
- 0.3 for previous-generation models
- 0.2 for most next-generation models
- 0.1 for next-generation English and Japanese models
A customization weight that you specify overrides a weight that was specified when the custom model was trained. The default value yields the best performance in general. Assign a higher value if your audio makes frequent use of OOV words from the custom model. Use caution when setting the weight: a higher value can improve the accuracy of phrases from the custom model's domain, but it can negatively affect performance on non-domain phrases.
See Using customization weight.
inactivity_timeout
integer
The time in seconds after which, if only silence (no speech) is detected in streaming audio, the connection is closed with a 400 error. The parameter is useful for stopping audio submission from a live microphone when a user simply walks away. Use `-1` for infinity. See Inactivity timeout.
keywords
array
An array of keyword strings to spot in the audio. Each keyword string can include one or more string tokens. Keywords are spotted only in the final results, not in interim hypotheses. If you specify any keywords, you must also specify a keywords threshold. Omit the parameter or specify an empty array if you do not need to spot keywords.
You can spot a maximum of 1000 keywords with a single request. A single keyword can have a maximum length of 1024 characters, though the maximum effective length for double-byte languages might be shorter. Keywords are case-insensitive.
See Keyword spotting.
keywords_threshold
number
A confidence value that is the lower bound for spotting a keyword. A word is considered to match a keyword if its confidence is greater than or equal to the threshold. Specify a probability between 0.0 and 1.0. If you specify a threshold, you must also specify one or more keywords. The service performs no keyword spotting if you omit either parameter. See Keyword spotting.
max_alternatives
integer
The maximum number of alternative transcripts that the service is to return. By default, the service returns a single transcript. If you specify a value of `0`, the service uses the default value, `1`. See Maximum alternatives.
word_alternatives_threshold
number
A confidence value that is the lower bound for identifying a hypothesis as a possible word alternative (also known as "Confusion Networks"). An alternative word is considered if its confidence is greater than or equal to the threshold. Specify a probability between 0.0 and 1.0. By default, the service computes no alternative words. See Word alternatives.
word_confidence
boolean
If `true`, the service returns a confidence measure in the range of 0.0 to 1.0 for each word. By default, the service returns no word confidence scores. See Word confidence.
timestamps
boolean
If `true`, the service returns time alignment for each word. By default, no timestamps are returned. See Word timestamps.
profanity_filter
boolean
If `true`, the service filters profanity from all output except for keyword results by replacing inappropriate words with a series of asterisks. Set the parameter to `false` to return results with no censoring.
Note: The parameter can be used with US English and Japanese transcription only. See Profanity filtering.
smart_formatting
boolean
If `true`, the service converts dates, times, series of digits and numbers, phone numbers, currency values, and internet addresses into more readable, conventional representations in the final transcript of a recognition request. For US English, the service also converts certain keyword strings to punctuation symbols. By default, the service performs no smart formatting.
Note: The parameter can be used with US English, Japanese, and Spanish (all dialects) transcription only.
See Smart formatting.
smart_formatting_version
integer
Smart formatting version for large speech models and next-generation models is supported in US English, Brazilian Portuguese, French, German, Spanish and French Canadian languages.
speaker_labels
boolean
If `true`, the response includes labels that identify which words were spoken by which participants in a multi-person exchange. By default, the service returns no speaker labels. Setting `speaker_labels` to `true` forces the `timestamps` parameter to be `true`, regardless of whether you specify `false` for the parameter.
- For previous-generation models, the parameter can be used with Australian English, US English, German, Japanese, Korean, and Spanish (both broadband and narrowband models) and UK English (narrowband model) transcription only.
- For large speech models and next-generation models, the parameter can be used with all available languages.
See Speaker labels.
grammar_name
string
The name of a grammar that is to be used with the recognition request. If you specify a grammar, you must also use the `language_customization_id` parameter to specify the name of the custom language model for which the grammar is defined. The service recognizes only strings that are recognized by the specified grammar; it does not recognize other custom words from the model's words resource.
See Using a grammar for speech recognition.
redaction
boolean
If `true`, the service redacts, or masks, numeric data from final transcripts. The feature redacts any number that has three or more consecutive digits by replacing each digit with an `X` character. It is intended to redact sensitive numeric data, such as credit card numbers. By default, the service performs no redaction.
When you enable redaction, the service automatically enables smart formatting, regardless of whether you explicitly disable that feature. To ensure maximum security, the service also disables keyword spotting (ignores the `keywords` and `keywords_threshold` parameters) and returns only a single final transcript (forces the `max_alternatives` parameter to be `1`).
Note: The parameter can be used with US English, Japanese, and Korean transcription only.
See Numeric redaction.
processing_metrics
boolean
If `true`, requests processing metrics about the service's transcription of the input audio. The service returns processing metrics at the interval specified by the `processing_metrics_interval` parameter. It also returns processing metrics for transcription events, for example, for final and interim results. By default, the service returns no processing metrics.
See Processing metrics.
processing_metrics_interval
number
Specifies the interval in real wall-clock seconds at which the service is to return processing metrics. The parameter is ignored unless the `processing_metrics` parameter is set to `true`.
The parameter accepts a minimum value of 0.1 seconds. The level of precision is not restricted, so you can specify values such as 0.25 and 0.125.
The service does not impose a maximum value. If you want to receive processing metrics only for transcription events instead of at periodic intervals, set the value to a large number. If the value is larger than the duration of the audio, the service returns processing metrics only for transcription events.
See Processing metrics.
audio_metrics
boolean
If `true`, requests detailed information about the signal characteristics of the input audio. The service returns audio metrics with the final transcription results. By default, the service returns no audio metrics.
See Audio metrics.
end_of_phrase_silence_time
number
Specifies the duration of the pause interval at which the service splits a transcript into multiple final results. If the service detects pauses or extended silence before it reaches the end of the audio stream, its response can include multiple final results. Silence indicates a point at which the speaker pauses between spoken words or phrases.
Specify a value for the pause interval in the range of 0.0 to 120.0.
- A value greater than 0 specifies the interval that the service is to use for speech recognition.
- A value of 0 indicates that the service is to use the default interval. It is equivalent to omitting the parameter.
The default pause interval for most languages is 0.8 seconds; the default for Chinese is 0.6 seconds.
See End of phrase silence time.
split_transcript_at_phrase_end
boolean
If `true`, directs the service to split the transcript into multiple final results based on semantic features of the input, for example, at the conclusion of meaningful phrases such as sentences. The service bases its understanding of semantic features on the base language model that you use with a request. Custom language models and grammars can also influence how and where the service splits a transcript.
By default, the service splits transcripts based solely on the pause interval. If the parameters are used together on the same request, `end_of_phrase_silence_time` has precedence over `split_transcript_at_phrase_end`.
See Split transcript at phrase end.
speech_detector_sensitivity
number
The sensitivity of speech activity detection that the service is to perform. Use the parameter to suppress word insertions from music, coughing, and other non-speech events. The service biases the audio it passes for speech recognition by evaluating the input audio against prior models of speech and non-speech activity.
Specify a value between 0.0 and 1.0:
- 0.0 suppresses all audio (no speech is transcribed).
- 0.5 (the default) provides a reasonable compromise for the level of sensitivity.
- 1.0 suppresses no audio (speech detection sensitivity is disabled).
The values increase on a monotonic curve. Specifying one or two decimal places of precision (for example, `0.55`) is typically more than sufficient.
The parameter is supported with all large speech models, next-generation models and with most previous-generation models. See Speech detector sensitivity and Language model support.
sad_module
integer
Detects speech boundaries within the audio stream with better performance, improved noise suppression, faster responsiveness, and increased accuracy.
Specify `sad_module: 2`
See Speech Activity Detection (SAD).
background_audio_suppression
number
The level to which the service is to suppress background audio based on its volume to prevent it from being transcribed as speech. Use the parameter to suppress side conversations or background noise.
Specify a value in the range of 0.0 to 1.0:
- 0.0 (the default) provides no suppression (background audio suppression is disabled).
- 0.5 provides a reasonable level of audio suppression for general usage.
- 1.0 suppresses all audio (no audio is transcribed).
The values increase on a monotonic curve. Specifying one or two decimal places of precision (for example, `0.55`) is typically more than sufficient.
The parameter is supported with all large speech models, next-generation models and with most previous-generation models. See Background audio suppression and Language model support.
low_latency
boolean
If `true` for next-generation `Multimedia` and `Telephony` models that support low latency, directs the service to produce results even more quickly than it usually does. Next-generation models produce transcription results faster than previous-generation models. The `low_latency` parameter causes the models to produce results even more quickly, though the results might be less accurate when the parameter is used.
The parameter is not available for large speech models and previous-generation `Broadband` and `Narrowband` models. It is available for most next-generation models.
- For a list of next-generation models that support low latency, see Supported next-generation language models.
- For more information about the `low_latency` parameter, see Low latency.
character_insertion_bias
number
For large speech models and next-generation models, an indication of whether the service is biased to recognize shorter or longer strings of characters when developing transcription hypotheses. By default, the service is optimized to produce the best balance of strings of different lengths.
The default bias is 0.0. The allowable range of values is -1.0 to 1.0.
- Negative values bias the service to favor hypotheses with shorter strings of characters.
- Positive values bias the service to favor hypotheses with longer strings of characters.
As the value approaches -1.0 or 1.0, the impact of the parameter becomes more pronounced. To determine the most effective value for your scenario, start by setting the value of the parameter to a small increment, such as -0.1, -0.05, 0.05, or 0.1, and assess how the value impacts the transcription results. Then experiment with different values as necessary, adjusting the value by small increments.
The parameter is not available for previous-generation models.
Response
201 - Created. The job was successfully created.
id
string
The ID of the asynchronous job.
status
string
The current status of the job:
- `waiting`: The service is preparing the job for processing. The service returns this status when the job is initially created or when it is waiting for capacity to process the job. The job remains in this state until the service has the capacity to begin processing it.
- `processing`: The service is actively processing the job.
- `completed`: The service has finished processing the job. If the job specified a callback URL and the event `recognitions.completed_with_results`, the service sent the results with the callback notification. Otherwise, you must retrieve the results by checking the individual job.
- `failed`: The job failed.
created
string
The date and time in Coordinated Universal Time (UTC) at which the job was created. The value is provided in full ISO 8601 format (`YYYY-MM-DDThh:mm:ss.sTZD`).
updated
string
The date and time in Coordinated Universal Time (UTC) at which the job was last updated by the service. The value is provided in full ISO 8601 format (`YYYY-MM-DDThh:mm:ss.sTZD`). This field is returned only by the Check jobs and [Check a job[(#checkjob) methods.
url
string
The URL to use to request information about the job with the Check a job method. This field is returned only by the Create a job method.
user_token
string
The user token associated with a job that was created with a callback URL and a user token. This field can be returned only by the Check jobs method.
results
array
If the status is `completed`, the results of the recognition request as an array that includes a single instance of a `SpeechRecognitionResults` object. This field is returned only by the Check a job method.
warnings
array
An array of warning messages about invalid parameters included with the request. Each warning includes a descriptive message and a list of invalid argument strings, for example, `"unexpected query parameter 'user_token', query parameter 'callback_url' was not specified"`. The request succeeds despite the warnings. This field can be returned only by the Create a job method. (If you use the `character_insertion_bias` parameter with a previous-generation model, the warning message refers to the parameter as `lambdaBias`.)
400 - Bad Request. The request failed because of a user input error. For example, the request passed audio that does not match the indicated format or failed to specify a required audio format; specified a custom language or custom acoustic model that is not in the `available` state; or specified both the `recognitions.completed` and `recognitions.completed_with_results` events. Specific messages include
- `Model {model} not found`
- `Requested model is not available`
- `This 8000hz audio input requires a narrow band model. See /v1/models for a list of available models.`
- `speaker_labels is not a supported feature for model {model}`
- `keywords_threshold value must be between zero and one (inclusive)`
- `word_alternatives_threshold value must be between zero and one (inclusive)`
- `You cannot specify both 'customization_id' and 'language_customization_id' parameter!`
- `No speech detected for 30s`
- `Unable to transcode data stream application/octet-stream -> audio/l16`
- `Stream was {number} bytes but needs to be at least 100 bytes.`
- `keyword {keyword} length exceeds the maximum length 1024`
- `low_latency is not a supported feature for model {model}`
- `Character insertion bias must be a value between -1 and 1.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
404 - Not Found. The specified model does not exist or, for IBM Cloud Pak for Data, the `model` parameter was not specified but the default model is not installed. The message is `Model '{model}' not found`.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Check jobs
GET /v1/recognitions
Returns the ID and status of the latest 100 outstanding jobs associated with the 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` or not one of the latest 100 outstanding jobs, use the [Check a job[(#checkjob) 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.
See also: Checking the status of the latest jobs.
Request
Response
200 - OK. The request succeeded.
recognitions
array
An array of `RecognitionJob` objects that provides the status for each of the user's current jobs. The array is empty if the user has no current jobs.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
See also: Checking the status and retrieving the results of a job.">
Check a job
GET /v1/recognitions/{id}
Returns information about the specified job. The response always includes the status of the job and its creation and update times. If the status is `completed`, the response includes the results of the recognition request. You must use credentials for the instance of the service that owns a job to list information about it.
You can use the method to retrieve the results of any job, regardless of whether it was submitted with a callback URL and the `recognitions.completed_with_results` event, and you can retrieve the results multiple times for as long as they remain available. Use the Check jobs method to request information about the most recent jobs associated with the calling credentials.
See also: Checking the status and retrieving the results of a job.
Request
Path Parameters
id
Required *
string
The identifier of the asynchronous job that is to be used for the request. You must make the request with credentials for the instance of the service that owns the job.
Query Parameters
Response
200 - OK. The request succeeded.
id
string
The ID of the asynchronous job.
status
string
The current status of the job:
- `waiting`: The service is preparing the job for processing. The service returns this status when the job is initially created or when it is waiting for capacity to process the job. The job remains in this state until the service has the capacity to begin processing it.
- `processing`: The service is actively processing the job.
- `completed`: The service has finished processing the job. If the job specified a callback URL and the event `recognitions.completed_with_results`, the service sent the results with the callback notification. Otherwise, you must retrieve the results by checking the individual job.
- `failed`: The job failed.
created
string
The date and time in Coordinated Universal Time (UTC) at which the job was created. The value is provided in full ISO 8601 format (`YYYY-MM-DDThh:mm:ss.sTZD`).
updated
string
The date and time in Coordinated Universal Time (UTC) at which the job was last updated by the service. The value is provided in full ISO 8601 format (`YYYY-MM-DDThh:mm:ss.sTZD`). This field is returned only by the Check jobs and [Check a job[(#checkjob) methods.
url
string
The URL to use to request information about the job with the Check a job method. This field is returned only by the Create a job method.
user_token
string
The user token associated with a job that was created with a callback URL and a user token. This field can be returned only by the Check jobs method.
results
array
If the status is `completed`, the results of the recognition request as an array that includes a single instance of a `SpeechRecognitionResults` object. This field is returned only by the Check a job method.
warnings
array
An array of warning messages about invalid parameters included with the request. Each warning includes a descriptive message and a list of invalid argument strings, for example, `"unexpected query parameter 'user_token', query parameter 'callback_url' was not specified"`. The request succeeds despite the warnings. This field can be returned only by the Create a job method. (If you use the `character_insertion_bias` parameter with a previous-generation model, the warning message refers to the parameter as `lambdaBias`.)
404 - Not Found. The specified job ID was not found.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Delete a job
DELETE /v1/recognitions/{id}
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 use credentials for the instance of the service that owns a job to delete it.
See also: Deleting a job.
Request
Path Parameters
id
Required *
string
The identifier of the asynchronous job that is to be used for the request. You must make the request with credentials for the instance of the service that owns the job.
Query Parameters
Response
204 - No Content. The job was successfully deleted.
400 - Bad Request. The service cannot delete a job that it is actively processing:
- `Unable to delete the processing job`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
404 - Not Found. The specified job ID was not found.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
See also:
Large speech models and Next-generation models
The service supports large speech models and next-generation `Multimedia` (16 kHz) and `Telephony` (8 kHz) models for many languages. Large speech models and next-generation models have higher throughput than the service's previous generation of `Broadband` and `Narrowband` models. When you use large speech models and next-generation models, the service can return transcriptions more quickly and also provide noticeably better transcription accuracy.
You specify a large speech model or next-generation model by using the `model` query parameter, as you do a previous-generation model. Only the next-generation models support the `low_latency` parameter, and all large speech models and next-generation models support the `character_insertion_bias` parameter. These parameters are not available with previous-generation models.
Large speech models and next-generation models do not support all of the speech recognition parameters that are available for use with previous-generation models. Next-generation models do not support the following parameters:
- `acoustic_customization_id`
- `keywords` and `keywords_threshold`
- `processing_metrics` and `processing_metrics_interval`
- `word_alternatives_threshold`
Important: Effective 31 July 2023, all previous-generation models will be removed from the service and the documentation. Most previous-generation models were deprecated on 15 March 2022. You must migrate to the equivalent large speech model or next-generation model by 31 July 2023. For more information, see Migrating to large speech models.
See also:
- Large speech languages and models
- Supported features for large speech models
- Next-generation languages and models
- Supported features for next-generation models">
Create a custom language model
POST /v1/customizations
Creates a new custom language model for a specified base model. The custom language model can be used only with the base model for which it is created. The model is owned by the instance of the service whose credentials are used to create it.
You can create a maximum of 1024 custom language models per owning credentials. The service returns an error if you attempt to create more than 1024 models. You do not lose any models, but you cannot create any more until your model count is below the limit.
Important: Effective 31 July 2023, all previous-generation models will be removed from the service and the documentation. Most previous-generation models were deprecated on 15 March 2022. You must migrate to the equivalent large speech model or next-generation model by 31 July 2023. For more information, see Migrating to large speech models.
See also:
Large speech models and Next-generation models
The service supports large speech models and next-generation `Multimedia` (16 kHz) and `Telephony` (8 kHz) models for many languages. Large speech models and next-generation models have higher throughput than the service's previous generation of `Broadband` and `Narrowband` models. When you use large speech models and next-generation models, the service can return transcriptions more quickly and also provide noticeably better transcription accuracy.
You specify a large speech model or next-generation model by using the `model` query parameter, as you do a previous-generation model. Only the next-generation models support the `low_latency` parameter, and all large speech models and next-generation models support the `character_insertion_bias` parameter. These parameters are not available with previous-generation models.
Large speech models and next-generation models do not support all of the speech recognition parameters that are available for use with previous-generation models. Next-generation models do not support the following parameters:
- `acoustic_customization_id`
- `keywords` and `keywords_threshold`
- `processing_metrics` and `processing_metrics_interval`
- `word_alternatives_threshold`
Important: Effective 31 July 2023, all previous-generation models will be removed from the service and the documentation. Most previous-generation models were deprecated on 15 March 2022. You must migrate to the equivalent large speech model or next-generation model by 31 July 2023. For more information, see Migrating to large speech models.
See also:
- Large speech languages and models
- Supported features for large speech models
- Next-generation languages and models
- Supported features for next-generation models
Request
Request Body
CreateLanguageModel
A `CreateLanguageModel` object that provides basic information about the new custom language model.
name
Required *
string
A user-defined name for the new custom language model. Use a localized name that matches the language of the custom model. Use a name that describes the domain of the custom model, such as `Medical custom model` or `Legal custom model`. Use a name that is unique among all custom language models that you own.
Include a maximum of 256 characters in the name. Do not use backslashes, slashes, colons, equal signs, ampersands, or question marks in the name.
base_model_name
Required *
string
The name of the base language model that is to be customized by the new custom language model. The new custom model can be used only with the base model that it customizes.
To determine whether a base model supports language model customization, use the Get a model method and check that the attribute `custom_language_model` is set to `true`. You can also refer to Language support for customization.
dialect
string
The dialect of the specified language that is to be used with the custom language model. For all languages, it is always safe to omit this field. The service automatically uses the language identifier from the name of the base model. For example, the service automatically uses `en-US` for all US English models.
If you specify the `dialect` for a new custom model, follow these guidelines. For non-Spanish previous-generation models and for next-generation models, you must specify a value that matches the five-character language identifier from the name of the base model. For Spanish previous-generation models, you must specify one of the following values:
- `es-ES` for Castilian Spanish (`es-ES` models)
- `es-LA` for Latin American Spanish (`es-AR`, `es-CL`, `es-CO`, and `es-PE` models)
- `es-US` for Mexican (North American) Spanish (`es-MX` models)
All values that you pass for the `dialect` field are case-insensitive.
description
string
A recommended description of the new custom language model. Use a localized description that matches the language of the custom model. Include a maximum of 128 characters in the description.
Response
201 - Created. The custom language model was successfully created.
customization_id
string
The customization ID (GUID) of the custom language model. The Create a custom language model method returns only this field of the object; it does not return the other fields.
created
string
The date and time in Coordinated Universal Time (UTC) at which the custom language model was created. The value is provided in full ISO 8601 format (`YYYY-MM-DDThh:mm:ss.sTZD`).
updated
string
The date and time in Coordinated Universal Time (UTC) at which the custom language model was last modified. The `created` and `updated` fields are equal when a language model is first added but has yet to be updated. The value is provided in full ISO 8601 format (YYYY-MM-DDThh:mm:ss.sTZD).
language
string
The language identifier of the custom language model (for example, `en-US`). The value matches the five-character language identifier from the name of the base model for the custom model. This value might be different from the value of the `dialect` field.
dialect
string
The dialect of the language for the custom language model. For custom models that are based on non-Spanish previous-generation models and on next-generation models, the field matches the language of the base model; for example, `en-US` for one of the US English models. For custom models that are based on Spanish previous-generation models, the field indicates the dialect with which the model was created. The value can match the name of the base model or, if it was specified by the user, can be one of the following:
- `es-ES` for Castilian Spanish (`es-ES` models)
- `es-LA` for Latin American Spanish (`es-AR`, `es-CL`, `es-CO`, and `es-PE` models)
- `es-US` for Mexican (North American) Spanish (`es-MX` models)
Dialect values are case-insensitive.
versions
array
A list of the available versions of the custom language model. Each element of the array indicates a version of the base model with which the custom model can be used. Multiple versions exist only if the custom model has been upgraded to a new version of its base model. Otherwise, only a single version is shown.
owner
string
The GUID of the credentials for the instance of the service that owns the custom language model.
name
string
The name of the custom language model.
description
string
The description of the custom language model.
base_model_name
string
The name of the language model for which the custom language model was created.
status
string
The current status of the custom language model:
- `pending`: The model was created but is waiting either for valid training data to be added or for the service to finish analyzing added data.
- `ready`: The model contains valid data and is ready to be trained. If the model contains a mix of valid and invalid resources, you need to set the `strict` parameter to `false` for the training to proceed.
- `training`: The model is currently being trained.
- `available`: The model is trained and ready to use.
- `upgrading`: The model is currently being upgraded.
- `failed`: Training of the model failed.
progress
integer
A percentage that indicates the progress of the custom language model's current training. A value of `100` means that the model is fully trained. Note: The `progress` field does not currently reflect the progress of the training. The field changes from `0` to `100` when training is complete.
error
string
If an error occurred while adding a grammar file to the custom language model, a message that describes an `Internal Server Error` and includes the string `Cannot compile grammar`. The status of the custom model is not affected by the error, but the grammar cannot be used with the model.
warnings
string
If the request included unknown parameters, the following message: `Unexpected query parameter(s) ['parameters'] detected`, where `parameters` is a list that includes a quoted string for each unknown parameter.
400 - Bad Request. A required parameter is null or invalid. Specific failure messages include:
- `Required parameter '{name}' is missing`
- `Required parameter '{name}' cannot be empty string`
- `Required parameter '{name}' cannot be null`
- `The base model '{model_name}' is not recognized`
- `Language customization is not supported for base model '{model_name}'`
- `Invalid dialect value '{dialect}' specified for language '{language}'`
- `You exceeded the maximum '{model_number}' of allowed custom language models. You have '{model_number}' custom language models. Please remove the models you do not need or contact the IBM speech support team to apply for an exception.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
List custom language models
GET /v1/customizations
Lists information about all custom language models that are owned by an instance of the service. Use the `language` parameter to see all custom language models for the specified language. Omit the parameter to see all custom language models for all languages. You must use credentials for the instance of the service that owns a model to list information about it.
See also:
Request
Path Parameters
Query Parameters
language
string
The identifier of the language for which custom language or custom acoustic models are to be returned. Specify the five-character language identifier; for example, specify `en-US` to see all custom language or custom acoustic models that are based on US English models. Omit the parameter to see all custom language or custom acoustic models that are owned by the requesting credentials.
To determine the languages for which customization is available, see Language support for customization.
Response
200 - OK. The request succeeded.
customizations
array
An array of `LanguageModel` objects that provides information about each available custom language model. The array is empty if the requesting credentials own no custom language models (if no language is specified) or own no custom language models for the specified language.
400 - Bad Request. A required parameter is null or invalid. Specific failure messages include:
- `Language '{language}' is not supported for customization`.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Get a custom language model
GET /v1/customizations/{customization_id}
Gets information about a specified custom language model. You must use credentials for the instance of the service that owns a model to list information about it.
See also:
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
Response
200 - OK. The request succeeded.
customization_id
string
The customization ID (GUID) of the custom language model. The Create a custom language model method returns only this field of the object; it does not return the other fields.
created
string
The date and time in Coordinated Universal Time (UTC) at which the custom language model was created. The value is provided in full ISO 8601 format (`YYYY-MM-DDThh:mm:ss.sTZD`).
updated
string
The date and time in Coordinated Universal Time (UTC) at which the custom language model was last modified. The `created` and `updated` fields are equal when a language model is first added but has yet to be updated. The value is provided in full ISO 8601 format (YYYY-MM-DDThh:mm:ss.sTZD).
language
string
The language identifier of the custom language model (for example, `en-US`). The value matches the five-character language identifier from the name of the base model for the custom model. This value might be different from the value of the `dialect` field.
dialect
string
The dialect of the language for the custom language model. For custom models that are based on non-Spanish previous-generation models and on next-generation models, the field matches the language of the base model; for example, `en-US` for one of the US English models. For custom models that are based on Spanish previous-generation models, the field indicates the dialect with which the model was created. The value can match the name of the base model or, if it was specified by the user, can be one of the following:
- `es-ES` for Castilian Spanish (`es-ES` models)
- `es-LA` for Latin American Spanish (`es-AR`, `es-CL`, `es-CO`, and `es-PE` models)
- `es-US` for Mexican (North American) Spanish (`es-MX` models)
Dialect values are case-insensitive.
versions
array
A list of the available versions of the custom language model. Each element of the array indicates a version of the base model with which the custom model can be used. Multiple versions exist only if the custom model has been upgraded to a new version of its base model. Otherwise, only a single version is shown.
owner
string
The GUID of the credentials for the instance of the service that owns the custom language model.
name
string
The name of the custom language model.
description
string
The description of the custom language model.
base_model_name
string
The name of the language model for which the custom language model was created.
status
string
The current status of the custom language model:
- `pending`: The model was created but is waiting either for valid training data to be added or for the service to finish analyzing added data.
- `ready`: The model contains valid data and is ready to be trained. If the model contains a mix of valid and invalid resources, you need to set the `strict` parameter to `false` for the training to proceed.
- `training`: The model is currently being trained.
- `available`: The model is trained and ready to use.
- `upgrading`: The model is currently being upgraded.
- `failed`: Training of the model failed.
progress
integer
A percentage that indicates the progress of the custom language model's current training. A value of `100` means that the model is fully trained. Note: The `progress` field does not currently reflect the progress of the training. The field changes from `0` to `100` when training is complete.
error
string
If an error occurred while adding a grammar file to the custom language model, a message that describes an `Internal Server Error` and includes the string `Cannot compile grammar`. The status of the custom model is not affected by the error, but the grammar cannot be used with the model.
warnings
string
If the request included unknown parameters, the following message: `Unexpected query parameter(s) ['parameters'] detected`, where `parameters` is a list that includes a quoted string for each unknown parameter.
400 - Bad Request. The specified customization ID is invalid:
- `Malformed GUID: '{customization_id}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Delete a custom language model
DELETE /v1/customizations/{customization_id}
Deletes an existing custom language model. The custom model cannot be deleted if another request, such as adding a corpus or grammar to the model, is currently being processed. You must use credentials for the instance of the service that owns a model to delete it.
See also:
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
Response
200 - OK. The custom language model was successfully deleted.
400 - Bad Request. The specified customization ID is invalid:
- `Malformed GUID: '{customization_id}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials, including the case where the custom model does not exist:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
The method returns a `LanguageModel` object that includes `status` and `progress` fields. A status of `available` means that the custom model is trained and ready to use. The service cannot accept subsequent training requests or requests to add new resources until the existing request completes.
For custom models that are based on improved base language models, training also performs an automatic upgrade to a newer version of the base model. You do not need to use the Upgrade a custom language model method to perform the upgrade.
See also:
- Language support for customization
- Train the custom language model
- Upgrading custom language models that are based on improved next-generation models
Training failures
Training can fail to start for the following reasons:
- The service is currently handling another request for the custom model, such as another training request or a request to add a corpus or grammar to the model.
- No training data have been added to the custom model.
- The custom model contains one or more invalid corpora, grammars, or words (for example, a custom word has an invalid sounds-like pronunciation). You can correct the invalid resources or set the `strict` parameter to `false` to exclude the invalid resources from the training. The model must contain at least one valid resource for training to succeed.">
Train a custom language model
POST /v1/customizations/{customization_id}/train
Initiates the training of a custom language model with new resources such as corpora, grammars, and custom words. After adding, modifying, or deleting resources for a custom language model, use this method to begin the actual training of the model on the latest data. You can specify whether the custom language model is to be trained with all words from its words resource or only with words that were added or modified by the user directly. You must use credentials for the instance of the service that owns a model to train it.
The training method is asynchronous. It can take on the order of minutes to complete depending on the amount of data on which the service is being trained and the current load on the service. The method returns an HTTP 200 response code to indicate that the training process has begun.
You can monitor the status of the training by using the Get a custom language model method to poll the model's status. Use a loop to check the status every 10 seconds. If you added custom words directly to a custom model that is based on a next-generation model, allow for some minutes of extra training time for the model.
The method returns a `LanguageModel` object that includes `status` and `progress` fields. A status of `available` means that the custom model is trained and ready to use. The service cannot accept subsequent training requests or requests to add new resources until the existing request completes.
For custom models that are based on improved base language models, training also performs an automatic upgrade to a newer version of the base model. You do not need to use the Upgrade a custom language model method to perform the upgrade.
See also:
- Language support for customization
- Train the custom language model
- Upgrading custom language models that are based on improved next-generation models
Training failures
Training can fail to start for the following reasons:
- The service is currently handling another request for the custom model, such as another training request or a request to add a corpus or grammar to the model.
- No training data have been added to the custom model.
- The custom model contains one or more invalid corpora, grammars, or words (for example, a custom word has an invalid sounds-like pronunciation). You can correct the invalid resources or set the `strict` parameter to `false` to exclude the invalid resources from the training. The model must contain at least one valid resource for training to succeed.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
word_type_to_add
string
For custom models that are based on previous-generation models, the type of words from the custom language model's words resource on which to train the model:
- `all` (the default) trains the model on all new words, regardless of whether they were extracted from corpora or grammars or were added or modified by the user.
- `user` trains the model only on custom words that were added or modified by the user directly. The model is not trained on new words extracted from corpora or grammars.
For custom models that are based on large speech models and next-generation models, the service ignores the `word_type_to_add` parameter. The words resource contains only custom words that the user adds or modifies directly, so the parameter is unnecessary.
customization_weight
number
Specifies a customization weight for the custom language model. The customization weight tells the service how much weight to give to words from the custom language model compared to those from the base model for speech recognition. Specify a value between 0.0 and 1.0. The default value is:
- 0.5 for large speech models
- 0.3 for previous-generation models
- 0.2 for most next-generation models
- 0.1 for next-generation English and Japanese models
The default value yields the best performance in general. Assign a higher value if your audio makes frequent use of OOV words from the custom model. Use caution when setting the weight: a higher value can improve the accuracy of phrases from the custom model's domain, but it can negatively affect performance on non-domain phrases.
The value that you assign is used for all recognition requests that use the model. You can override it for any recognition request by specifying a customization weight for that request.
See Using customization weight.
strict
boolean
If `false`, allows training of the custom language model to proceed as long as the model contains at least one valid resource. The method returns an array of `TrainingWarning` objects that lists any invalid resources. By default (`true`), training of a custom language model fails (status code 400) if the model contains one or more invalid resources (corpus files, grammar files, or custom words).
force
boolean
If `true`, forces the training of the custom language model regardless of whether it contains any changes (is in the `ready` or `available` state). By default (`false`), the model must be in the `ready` state to be trained. You can use the parameter to train and thus upgrade a custom model that is based on an improved next-generation model. The parameter is available only for IBM Cloud, not for IBM Cloud Pak for Data.
See Upgrading a custom language model based on an improved next-generation model.
Response
200 - OK. Training of the custom language model started successfully.
warnings
array
An array of `TrainingWarning` objects that lists any invalid resources contained in the custom model. For custom language models, invalid resources are grouped and identified by type of resource. The method can return warnings only if the `strict` parameter is set to `false`.
400 - Bad Request. A required parameter is null or invalid, the custom model is not ready to be trained, or the total number of words or OOV words exceeds the maximum threshold. Specific failure messages include:
- `No input data available for running training`
- `Fix errors in the following words: [{words}] before training`
- `Total number of words {number} exceeds maximum allowed`
- `Total number of OOV words {number} exceeds {maximum}`
- `Malformed GUID: '{customization_id}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Reset a custom language model
POST /v1/customizations/{customization_id}/reset
Resets a custom language model by removing all corpora, grammars, and words from the model. Resetting a custom language model initializes the model to its state when it was first created. Metadata such as the name and language of the model are preserved, but the model's words resource is removed and must be re-created. You must use credentials for the instance of the service that owns a model to reset it.
See also:
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
Response
200 - OK. The custom language model was successfully reset.
400 - Bad Request. The specified customization ID is invalid:
- `Malformed GUID: '{customization_id}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
While it is being upgraded, the custom model has the status `upgrading`. When the upgrade is complete, the model resumes the status that it had prior to upgrade. The service cannot accept subsequent requests for the model until the upgrade completes.
For custom models that are based on improved base language models, the Train a custom language model method also performs an automatic upgrade to a newer version of the base model. You do not need to use the upgrade method.
See also:
- Language support for customization
- Upgrading a custom language model
- Upgrading custom language models that are based on improved next-generation models">
Upgrade a custom language model
POST /v1/customizations/{customization_id}/upgrade_model
Initiates the upgrade of a custom language model to the latest version of its base language model. The upgrade method is asynchronous. It can take on the order of minutes to complete depending on the amount of data in the custom model and the current load on the service. A custom model must be in the `ready` or `available` state to be upgraded. You must use credentials for the instance of the service that owns a model to upgrade it.
The method returns an HTTP 200 response code to indicate that the upgrade process has begun successfully. You can monitor the status of the upgrade by using the Get a custom language model method to poll the model's status. The method returns a `LanguageModel` object that includes `status` and `progress` fields. Use a loop to check the status every 10 seconds.
While it is being upgraded, the custom model has the status `upgrading`. When the upgrade is complete, the model resumes the status that it had prior to upgrade. The service cannot accept subsequent requests for the model until the upgrade completes.
For custom models that are based on improved base language models, the Train a custom language model method also performs an automatic upgrade to a newer version of the base model. You do not need to use the upgrade method.
See also:
- Language support for customization
- Upgrading a custom language model
- Upgrading custom language models that are based on improved next-generation models
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
Response
200 - OK. Upgrade of the custom language model started successfully.
400 - Bad Request. The specified customization ID is invalid or the specified custom model cannot be upgraded:
- `Malformed GUID: '{customization_id}'`
- `Custom model is up-to-date`
- `No input data available to upgrade the model`
- `Cannot upgrade failed custom model`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
List corpora
GET /v1/customizations/{customization_id}/corpora
Lists information about all corpora from a custom language model. The information includes the name, status, and total number of words for each corpus. For custom models that are based on previous-generation models, it also includes the number of out-of-vocabulary (OOV) words from the corpus. You must use credentials for the instance of the service that owns a model to list its corpora.
See also: Listing corpora for a custom language model.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
Response
200 - OK. The request succeeded.
corpora
array
An array of `Corpus` objects that provides information about the corpora for the custom model. The array is empty if the custom model has no corpora.
400 - Bad Request. The specified customization ID is invalid:
- `Malformed GUID: '{customization_id}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
For custom models that are based on large speech models, the service parses and extracts word sequences from one or multiple corpora files. The characters help the service learn and predict character sequences from audio.
For custom models that are based on previous-generation models, the service auto-populates the model's words resource with words from the corpus that are not found in its base vocabulary. These words are referred to as out-of-vocabulary (OOV) words. After adding a corpus, you must validate the words resource to ensure that each OOV word's definition is complete and valid. You can use the List custom words method to examine the words resource. You can use other words method to eliminate typos and modify how words are pronounced and displayed as needed.
To add a corpus file that has the same name as an existing corpus, set the `allow_overwrite` parameter to `true`; otherwise, the request fails. Overwriting an existing corpus causes the service to process the corpus text file and extract its data anew. For a custom model that is based on a previous-generation model, the service first removes any OOV words that are associated with the existing corpus from the model's words resource unless they were also added by another corpus or grammar, or they have been modified in some way with the Add custom words or Add a custom word method.
The service limits the overall amount of data that you can add to a custom model to a maximum of 10 million total words from all sources combined. For a custom model that is based on a previous-generation model, you can add no more than 90 thousand custom (OOV) words to a model. This includes words that the service extracts from corpora and grammars, and words that you add directly.
See also:
- Add a corpus to the custom language model
- Working with corpora for previous-generation models
- Working with corpora for large speech models and next-generation models
- Validating a words resource for previous-generation models
- Validating a words resource for large speech models and next-generation models">
Add a corpus
POST /v1/customizations/{customization_id}/corpora/{corpus_name}
Adds a single corpus text file of new training data to a custom language model. Use multiple requests to submit multiple corpus text files. You must use credentials for the instance of the service that owns a model to add a corpus to it. Adding a corpus does not affect the custom language model until you train the model for the new data by using the Train a custom language model method.
Submit a plain text file that contains sample sentences from the domain of interest to enable the service to parse the words in context. The more sentences you add that represent the context in which speakers use words from the domain, the better the service's recognition accuracy.
The call returns an HTTP 201 response code if the corpus is valid. The service then asynchronously processes and automatically extracts data from the contents of the corpus. This operation can take on the order of minutes to complete depending on the current load on the service, the total number of words in the corpus, and, for custom models that are based on previous-generation models, the number of new (out-of-vocabulary) words in the corpus. You cannot submit requests to add additional resources to the custom model or to train the model until the service's analysis of the corpus for the current request completes. Use the Get a corpus method to check the status of the analysis.
For custom models that are based on large speech models, the service parses and extracts word sequences from one or multiple corpora files. The characters help the service learn and predict character sequences from audio.
For custom models that are based on previous-generation models, the service auto-populates the model's words resource with words from the corpus that are not found in its base vocabulary. These words are referred to as out-of-vocabulary (OOV) words. After adding a corpus, you must validate the words resource to ensure that each OOV word's definition is complete and valid. You can use the List custom words method to examine the words resource. You can use other words method to eliminate typos and modify how words are pronounced and displayed as needed.
To add a corpus file that has the same name as an existing corpus, set the `allow_overwrite` parameter to `true`; otherwise, the request fails. Overwriting an existing corpus causes the service to process the corpus text file and extract its data anew. For a custom model that is based on a previous-generation model, the service first removes any OOV words that are associated with the existing corpus from the model's words resource unless they were also added by another corpus or grammar, or they have been modified in some way with the Add custom words or Add a custom word method.
The service limits the overall amount of data that you can add to a custom model to a maximum of 10 million total words from all sources combined. For a custom model that is based on a previous-generation model, you can add no more than 90 thousand custom (OOV) words to a model. This includes words that the service extracts from corpora and grammars, and words that you add directly.
See also:
- Add a corpus to the custom language model
- Working with corpora for previous-generation models
- Working with corpora for large speech models and next-generation models
- Validating a words resource for previous-generation models
- Validating a words resource for large speech models and next-generation models
Request
Request Body
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
corpus_name
Required *
string
The name of the new corpus for the custom language model. Use a localized name that matches the language of the custom model and reflects the contents of the corpus.
- Include a maximum of 128 characters in the name.
- Do not use characters that need to be URL-encoded. For example, do not use spaces, slashes, backslashes, colons, ampersands, double quotes, plus signs, equals signs, questions marks, and so on in the name. (The service does not prevent the use of these characters. But because they must be URL-encoded wherever used, their use is strongly discouraged.)
- Do not use the name of an existing corpus or grammar that is already defined for the custom model.
- Do not use the name `user`, which is reserved by the service to denote custom words that are added or modified by the user.
- Do not use the name `base_lm` or `default_lm`. Both names are reserved for future use by the service.
Query Parameters
allow_overwrite
boolean
If `true`, the specified corpus overwrites an existing corpus with the same name. If `false`, the request fails if a corpus with the same name already exists. The parameter has no effect if a corpus with the same name does not already exist.
Response
201 - Created. Addition of the corpus data was successfully started. The service is analyzing the data.
400 - Bad Request. A required parameter is null or invalid, the specified corpus name already exists, or the custom model needs to be upgraded, among other possibilities. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Corpus file not specified or empty`
- `Corpus '{corpus_name}' already exists - change its name, remove existing file before adding new one, or overwrite existing file by setting 'allow_overwrite' to 'true'`
- `Grammar exists with corpus name '{corpus_name}'. Please use different name.`
- `TOTAL_NUMBER_OF_OOV_WORDS_EXCEEDS_MAXIMUM_ALLOWED_FORMAT: "Total number of OOV words {total_number} exceeds {maximum_allowed}"`
- `Analysis of corpus '{corpus_name}' failed due to {error_message}. Please fix the error then add the corpus again by setting the 'allow_overwrite' flag to 'true'.`, where `{error_message}` is a message of the form `{"code": 404, "error": "Model en-US_BroadbandModel (version: en-US_BroadbandModel.{version}) not found", "code_description": "Not Found"}`. Upgrade the custom language model to the latest version of its base language model, and then add the corpus to the custom model.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
405 - Method Not Allowed. The corpus name includes characters that need to be URL-encoded.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
415 - Unsupported Media Type. The request specified an unacceptable media type.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. An internal error prevented the service from satisfying the request. You can also receive status code 500 `Forwarding Error` if the service is currently busy handling a previous request for the custom model.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Get a corpus
GET /v1/customizations/{customization_id}/corpora/{corpus_name}
Gets information about a corpus from a custom language model. The information includes the name, status, and total number of words for the corpus. For custom models that are based on previous-generation models, it also includes the number of out-of-vocabulary (OOV) words from the corpus. You must use credentials for the instance of the service that owns a model to list its corpora.
See also: Listing corpora for a custom language model.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
corpus_name
Required *
string
The name of the corpus for the custom language model.
Query Parameters
Response
200 - OK. The request succeeded.
name
string
The name of the corpus.
total_words
integer
The total number of words in the corpus. The value is `0` while the corpus is being processed.
out_of_vocabulary_words
integer
For custom models that are based on large speech models and previous-generation models, the number of OOV words extracted from the corpus. The value is `0` while the corpus is being processed.
For custom models that are based on next-generation models, no OOV words are extracted from corpora, so the value is always `0`.
status
string
The status of the corpus:
- `analyzed`: The service successfully analyzed the corpus. The custom model can be trained with data from the corpus.
- `being_processed`: The service is still analyzing the corpus. The service cannot accept requests to add new resources or to train the custom model.
- `undetermined`: The service encountered an error while processing the corpus. The `error` field describes the failure.
error
string
If the status of the corpus is `undetermined`, the following message: `Analysis of corpus 'name' failed. Please try adding the corpus again by setting the 'allow_overwrite' flag to 'true'`.
400 - Bad Request. The specified customization ID or corpus name is invalid, including the case where the corpus does not exist for the custom model. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Invalid value for corpus name '{corpus_name}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
See also: Deleting a corpus from a custom language model.">
Delete a corpus
DELETE /v1/customizations/{customization_id}/corpora/{corpus_name}
Deletes an existing corpus from a custom language model. Removing a corpus does not affect the custom model until you train the model with the Train a custom language model method. You must use credentials for the instance of the service that owns a model to delete its corpora.
For custom models that are based on previous-generation models, the service removes any out-of-vocabulary (OOV) words that are associated with the corpus from the custom model's words resource unless they were also added by another corpus or grammar, or they were modified in some way with the Add custom words or Add a custom word method.
See also: Deleting a corpus from a custom language model.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
corpus_name
Required *
string
The name of the corpus for the custom language model.
Query Parameters
Response
200 - OK. The corpus was successfully deleted from the custom language model.
400 - Bad Request. The specified customization ID or corpus name is invalid, including the case where the corpus does not exist for the custom model. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Invalid value for corpus name '{corpus_name}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
405 - Method Not Allowed. No corpus name was specified with the request.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
List custom words
GET /v1/customizations/{customization_id}/words
Lists information about 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, for a custom model that is based on a previous-generation model, only out-of-vocabulary (OOV) words that were extracted from corpora or are recognized by grammars. For a custom model that is based on a next-generation model, you can list all words or only those words that were added directly by a user, which return the same results.
You can also indicate the order in which the service is to return words; by default, the service lists words in ascending alphabetical order. You must use credentials for the instance of the service that owns a model to list information about its words.
See also: Listing words from a custom language model.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
word_type
string
The type of words to be listed from the custom language model's words resource:
- `all` (the default) shows all words.
- `user` shows only custom words that were added or modified by the user directly.
- `corpora` shows only OOV that were extracted from corpora.
- `grammars` shows only OOV words that are recognized by grammars.
For a custom model that is based on a next-generation model, only `all` and `user` apply. Both options return the same results. Words from other sources are not added to custom models that are based on next-generation models.
sort
string
Indicates the order in which the words are to be listed, `alphabetical` or by `count`. You can prepend an optional `+` or `-` to an argument to indicate whether the results are to be sorted in ascending or descending order. By default, words are sorted in ascending alphabetical order. For alphabetical ordering, the lexicographical precedence is numeric values, uppercase letters, and lowercase letters. For count ordering, values with the same count are ordered alphabetically. With the `curl` command, URL-encode the `+` symbol as `%2B`.
Response
200 - OK. The request succeeded.
words
array
An array of `Word` objects that provides information about each word in the custom model's words resource. The array is empty if the custom model has no words.
400 - Bad Request. The specified customization ID is invalid:
- `Malformed GUID: '{customization_id}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
You add custom words by providing a `CustomWords` object, which is an array of `CustomWord` objects, one per word. Use the object's `word` parameter to identify the word that is to be added. You can also provide one or both of the optional `display_as` or `sounds_like` fields for each word.
- The `display_as` field provides a different way of spelling the word in a transcript. Use the parameter when you want the word to appear different from its usual representation or from its spelling in training data. For example, you might indicate that the word `IBM` is to be displayed as `IBM™`.
- The `sounds_like` field provides an array of one or more pronunciations for the word. Use the parameter to specify how the word can be pronounced by users. Use the parameter for words that are difficult to pronounce, foreign words, acronyms, and so on. For example, you might specify that the word `IEEE` can sound like `I triple E`. You can specify a maximum of five sounds-like pronunciations for a word. For a custom model that is based on a previous-generation model, if you omit the `sounds_like` field, the service attempts to set the field to its pronunciation of the word. It cannot generate a pronunciation for all words, so you must review the word's definition to ensure that it is complete and valid.
- The `mapping_only` field provides parameter for custom words. You can use the 'mapping_only' key in custom words as a form of post processing. This key parameter has a boolean value to determine whether 'sounds_like' (for non-Japanese models) or word (for Japanese) is not used for the model fine-tuning, but for the replacement for 'display_as'. This feature helps you when you use custom words exclusively to map 'sounds_like' (or word) to 'display_as' value. When you use custom words solely for post-processing purposes that does not need fine-tuning.
If you add a custom word that already exists in the words resource for the custom model, the new definition overwrites the existing data for the word. If the service encounters an error with the input data, it returns a failure code and does not add any of the words to the words resource.
The call returns an HTTP 201 response code if the input data is valid. It then asynchronously processes the words to add them to the model's words resource. The time that it takes for the analysis to complete depends on the number of new words that you add but is generally faster than adding a corpus or grammar.
You can monitor the status of the request by using the Get a custom language model method to poll the model's status. Use a loop to check the status every 10 seconds. The method returns a `Customization` object that includes a `status` field. A status of `ready` means that the words have been added to the custom model. The service cannot accept requests to add new data or to train the model until the existing request completes.
You can use the List custom words or Get a custom word method to review the words that you add. Words with an invalid `sounds_like` field include an `error` field that describes the problem. You can use other words-related methods to correct errors, eliminate typos, and modify how words are pronounced as needed.
See also:
- Add words to the custom language model
- Working with custom words for previous-generation models
- Working with custom words for large speech models and next-generation models
- Validating a words resource for previous-generation models
- Validating a words resource for large speech models and next-generation models">
Add custom words
POST /v1/customizations/{customization_id}/words
Adds one or more custom words to a custom language model. You can use this method to add words or to modify existing words in a custom model's words resource. For custom models that are based on previous-generation models, the service populates the words resource for a custom model with out-of-vocabulary (OOV) words from each corpus or grammar that is added to the model. You can use this method to modify OOV words in the model's words resource.
For a custom model that is based on a previous-generation model, the words resource for a model can contain a maximum of 90 thousand custom (OOV) words. This includes words that the service extracts from corpora and grammars and words that you add directly.
You must use credentials for the instance of the service that owns a model to add or modify custom words for 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 language model method.
You add custom words by providing a `CustomWords` object, which is an array of `CustomWord` objects, one per word. Use the object's `word` parameter to identify the word that is to be added. You can also provide one or both of the optional `display_as` or `sounds_like` fields for each word.
- The `display_as` field provides a different way of spelling the word in a transcript. Use the parameter when you want the word to appear different from its usual representation or from its spelling in training data. For example, you might indicate that the word `IBM` is to be displayed as `IBM™`.
- The `sounds_like` field provides an array of one or more pronunciations for the word. Use the parameter to specify how the word can be pronounced by users. Use the parameter for words that are difficult to pronounce, foreign words, acronyms, and so on. For example, you might specify that the word `IEEE` can sound like `I triple E`. You can specify a maximum of five sounds-like pronunciations for a word. For a custom model that is based on a previous-generation model, if you omit the `sounds_like` field, the service attempts to set the field to its pronunciation of the word. It cannot generate a pronunciation for all words, so you must review the word's definition to ensure that it is complete and valid.
- The `mapping_only` field provides parameter for custom words. You can use the 'mapping_only' key in custom words as a form of post processing. This key parameter has a boolean value to determine whether 'sounds_like' (for non-Japanese models) or word (for Japanese) is not used for the model fine-tuning, but for the replacement for 'display_as'. This feature helps you when you use custom words exclusively to map 'sounds_like' (or word) to 'display_as' value. When you use custom words solely for post-processing purposes that does not need fine-tuning.
If you add a custom word that already exists in the words resource for the custom model, the new definition overwrites the existing data for the word. If the service encounters an error with the input data, it returns a failure code and does not add any of the words to the words resource.
The call returns an HTTP 201 response code if the input data is valid. It then asynchronously processes the words to add them to the model's words resource. The time that it takes for the analysis to complete depends on the number of new words that you add but is generally faster than adding a corpus or grammar.
You can monitor the status of the request by using the Get a custom language model method to poll the model's status. Use a loop to check the status every 10 seconds. The method returns a `Customization` object that includes a `status` field. A status of `ready` means that the words have been added to the custom model. The service cannot accept requests to add new data or to train the model until the existing request completes.
You can use the List custom words or Get a custom word method to review the words that you add. Words with an invalid `sounds_like` field include an `error` field that describes the problem. You can use other words-related methods to correct errors, eliminate typos, and modify how words are pronounced as needed.
See also:
- Add words to the custom language model
- Working with custom words for previous-generation models
- Working with custom words for large speech models and next-generation models
- Validating a words resource for previous-generation models
- Validating a words resource for large speech models and next-generation models
Request
Request Body
CustomWords
A `CustomWords` object that provides information about one or more custom words that are to be added to or updated in the custom language model.
words
Required *
array
An array of `CustomWord` objects that provides information about each custom word that is to be added to or updated in the custom language model.
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
Response
201 - Created. Addition of the custom words was successfully started. The service is analyzing the data.
400 - Bad Request. A required parameter is null or invalid, the JSON input is invalid, or the maximum number of sounds-like pronunciations for a word is exceeded. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Required property '{property}' is missing in JSON '{JSON}'`
- `Word '{word}' contains invalid character character`
- `Maximum number of sounds-like for a word exceeded`
- `Maximum number of allowed phones of one item of sounds_like for word '{word}' exceeded`
- `Malformed JSON: '{JSON}'`
- `Wrong type of parameter '{parameter}' detected in the passed JSON`
- `TOTAL_NUMBER_OF_OOV_WORDS_EXCEEDS_MAXIMUM_ALLOWED_FORMAT: "Total number of OOV words {total_number} exceeds {maximum_allowed}"`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Use the `word_name` parameter to specify the custom word that is to be added or modified. Use the `CustomWord` object to provide one or both of the optional `display_as` or `sounds_like` fields for the word.
- The `display_as` field provides a different way of spelling the word in a transcript. Use the parameter when you want the word to appear different from its usual representation or from its spelling in training data. For example, you might indicate that the word `IBM` is to be displayed as `IBM™`.
- The `sounds_like` field provides an array of one or more pronunciations for the word. Use the parameter to specify how the word can be pronounced by users. Use the parameter for words that are difficult to pronounce, foreign words, acronyms, and so on. For example, you might specify that the word `IEEE` can sound like `i triple e`. You can specify a maximum of five sounds-like pronunciations for a word. For custom models that are based on previous-generation models, if you omit the `sounds_like` field, the service attempts to set the field to its pronunciation of the word. It cannot generate a pronunciation for all words, so you must review the word's definition to ensure that it is complete and valid.
If you add a custom word that already exists in the words resource for the custom model, the new definition overwrites the existing data for the word. If the service encounters an error, it does not add the word to the words resource. Use the Get a custom word method to review the word that you add.
See also:
- Add words to the custom language model
- Working with custom words for previous-generation models
- Working with custom words for large speech models and next-generation models
- Validating a words resource for previous-generation models
- Validating a words resource for large speech models and next-generation models">
Add a custom word
PUT /v1/customizations/{customization_id}/words/{word_name}
Adds a custom word to a custom language model. You can use this method to add a word or to modify an existing word in the words resource. For custom models that are based on previous-generation models, the service populates the words resource for a custom model with out-of-vocabulary (OOV) words from each corpus or grammar that is added to the model. You can use this method to modify OOV words in the model's words resource.
For a custom model that is based on a previous-generation models, the words resource for a model can contain a maximum of 90 thousand custom (OOV) words. This includes words that the service extracts from corpora and grammars and words that you add directly.
You must use credentials for the instance of the service that owns a model 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 language model method.
Use the `word_name` parameter to specify the custom word that is to be added or modified. Use the `CustomWord` object to provide one or both of the optional `display_as` or `sounds_like` fields for the word.
- The `display_as` field provides a different way of spelling the word in a transcript. Use the parameter when you want the word to appear different from its usual representation or from its spelling in training data. For example, you might indicate that the word `IBM` is to be displayed as `IBM™`.
- The `sounds_like` field provides an array of one or more pronunciations for the word. Use the parameter to specify how the word can be pronounced by users. Use the parameter for words that are difficult to pronounce, foreign words, acronyms, and so on. For example, you might specify that the word `IEEE` can sound like `i triple e`. You can specify a maximum of five sounds-like pronunciations for a word. For custom models that are based on previous-generation models, if you omit the `sounds_like` field, the service attempts to set the field to its pronunciation of the word. It cannot generate a pronunciation for all words, so you must review the word's definition to ensure that it is complete and valid.
If you add a custom word that already exists in the words resource for the custom model, the new definition overwrites the existing data for the word. If the service encounters an error, it does not add the word to the words resource. Use the Get a custom word method to review the word that you add.
See also:
- Add words to the custom language model
- Working with custom words for previous-generation models
- Working with custom words for large speech models and next-generation models
- Validating a words resource for previous-generation models
- Validating a words resource for large speech models and next-generation models
Request
Request Body
CustomWord
A `CustomWord` object that provides information about the specified custom word. Specify an empty object to add a word with no sounds-like or display-as information.
word
string
For the Add custom words method, you must specify the custom word that is to be added to or updated in the custom model. Do not use characters that need to be URL-encoded, for example, spaces, slashes, backslashes, colons, ampersands, double quotes, plus signs, equals signs, or question marks. Use a `-` (dash) or `_` (underscore) to connect the tokens of compound words. A Japanese custom word can include at most 25 characters, not including leading or trailing spaces.
Omit this parameter for the Add a custom word method.
mapping_only
boolean
Parameter for custom words. You can use the 'mapping_only' key in custom words as a form of post processing. This key parameter has a boolean value to determine whether 'sounds_like' (for non-Japanese models) or word (for Japanese) is not used for the model fine-tuning, but for the replacement for 'display_as'. This feature helps you when you use custom words exclusively to map 'sounds_like' (or word) to 'display_as' value. When you use custom words solely for post-processing purposes that does not need fine-tuning.
sounds_like
array
As array of sounds-like pronunciations for the custom word. Specify how words that are difficult to pronounce, foreign words, acronyms, and so on can be pronounced by users.
- For custom models that are based on previous-generation models, for a word that is not in the service's base vocabulary, omit the parameter to have the service automatically generate a sounds-like pronunciation for the word.
- For a word that is in the service's base vocabulary, use the parameter to specify additional pronunciations for the word. You cannot override the default pronunciation of a word; pronunciations you add augment the pronunciation from the base vocabulary.
A word can have at most five sounds-like pronunciations. A pronunciation can include at most 40 characters, not including leading or trailing spaces. A Japanese pronunciation can include at most 25 characters, not including leading or trailing spaces.
display_as
string
An alternative spelling for the custom word when it appears in a transcript. Use the parameter when you want the word to have a spelling that is different from its usual representation or from its spelling in corpora training data.
For custom models that are based on next-generation models, the service uses the spelling of the word as the display-as value if you omit the field.
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
word_name
Required *
string
The custom word that is to be added to or updated in the custom language model. Do not use characters that need to be URL-encoded, for example, spaces, slashes, backslashes, colons, ampersands, double quotes, plus signs, equals signs, or question marks. Use a `-` (dash) or `_` (underscore) to connect the tokens of compound words. URL-encode the word if it includes non-ASCII characters. For more information, see Character encoding.
Query Parameters
Response
201 - Created. The custom word was successfully added to the custom language model.
400 - Bad Request. The specified customization ID is invalid, or the maximum number of sounds-like pronunciations for a word is exceeded. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Maximum number of sounds-like for a word exceeded`
- `Maximum number of allowed phones of one item of sounds_like for word '{word}' exceeded`
- `TOTAL_NUMBER_OF_OOV_WORDS_EXCEEDS_MAXIMUM_ALLOWED_FORMAT: "Total number of OOV words {total_number} exceeds {maximum_allowed}"`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
405 - Method Not Allowed. The word name includes characters that need to be URL-encoded.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Get a custom word
GET /v1/customizations/{customization_id}/words/{word_name}
Gets information about a custom word from a custom language model. You must use credentials for the instance of the service that owns a model to list information about its words.
See also: Listing words from a custom language model.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
word_name
Required *
string
The custom word that is to be read from the custom language model. URL-encode the word if it includes non-ASCII characters. For more information, see Character encoding.
Query Parameters
Response
200 - OK. The request succeeded.
word
string
A word from the custom model's words resource. The spelling of the word is used to train the model.
mapping_only
boolean
(Optional) Parameter for custom words. You can use the 'mapping_only' key in custom words as a form of post processing. A boolean value that indicates whether the added word should be used to fine-tune the mode for selected next-gen models. This field appears in the response body only when it's 'For a custom model that is based on a previous-generation model', the mapping_only field is populated with the value set by the user, but would not be used.
sounds_like
array
An array of as many as five pronunciations for the word.
- For a custom model that is based on a previous-generation model, in addition to sounds-like pronunciations that were added by a user, the array can include a sounds-like pronunciation that is automatically generated by the service if none is provided when the word is added to the custom model.
- For a custom model that is based on a next-generation model, the array can include only sounds-like pronunciations that were added by a user.
display_as
string
The spelling of the word that the service uses to display the word in a transcript.
- For a custom model that is based on a previous-generation model, the field can contain an empty string if no display-as value is provided for a word that exists in the service's base vocabulary. In this case, the word is displayed as it is spelled.
- For a custom model that is based on a next-generation model, the service uses the spelling of the word as the value of the display-as field when the word is added to the model.
count
integer
For a custom model that is based on a previous-generation model, a sum of the number of times the word is found across all corpora and grammars. For example, if the word occurs five times in one corpus and seven times in another, its count is `12`. If you add a custom word to a model before it is added by any corpora or grammars, the count begins at `1`; if the word is added from a corpus or grammar first and later modified, the count reflects only the number of times it is found in corpora and grammars.
For a custom model that is based on a next-generation model, the `count` field for any word is always `1`.
source
array
An array of sources that describes how the word was added to the custom model's words resource.
- For a custom model that is based on previous-generation model, the field includes the name of each corpus and grammar from which the service extracted the word. For OOV that are added by multiple corpora or grammars, the names of all corpora and grammars are listed. If you modified or added the word directly, the field includes the string `user`.
- For a custom model that is based on a next-generation model, this field shows only `user` for custom words that were added directly to the custom model. Words from corpora and grammars are not added to the words resource for custom models that are based on next-generation models.
error
array
If the service discovered one or more problems that you need to correct for the word's definition, an array that describes each of the errors.
400 - Bad Request. The specified customization ID or word is invalid, including the case where the word does not exist for the custom model. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Invalid value for word '{word}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Delete a custom word
DELETE /v1/customizations/{customization_id}/words/{word_name}
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 the word only from the words resource; the word remains in the base vocabulary. Removing a custom word does not affect the custom model until you train the model with the Train a custom language model method. You must use credentials for the instance of the service that owns a model to delete its words.
See also: Deleting a word from a custom language model.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
word_name
Required *
string
The custom word that is to be deleted from the custom language model. URL-encode the word if it includes non-ASCII characters. For more information, see Character encoding.
Query Parameters
Response
200 - OK. The custom word was successfully deleted from the custom language model.
400 - Bad Request. The specified customization ID or word is invalid, including the case where the word does not exist for the custom model. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Invalid value for word '{word}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
405 - Method Not Allowed. No word name was specified with the request.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
List grammars
GET /v1/customizations/{customization_id}/grammars
Lists information about all grammars from a custom language model. For each grammar, the information includes the name, status, and (for grammars that are based on previous-generation models) the total number of out-of-vocabulary (OOV) words. You must use credentials for the instance of the service that owns a model to list its grammars.
See also:
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
Response
200 - OK. The request succeeded.
grammars
array
An array of `Grammar` objects that provides information about the grammars for the custom model. The array is empty if the custom model has no grammars.
400 - Bad Request. The specified customization ID is invalid:
- `Malformed GUID: '{customization_id}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
For grammars that are based on previous-generation models, the service populates the model's words resource with any word that is recognized by the grammar that is not found in the model's base vocabulary. These are referred to as out-of-vocabulary (OOV) words. You can use the List custom words method to examine the words resource and use other words-related methods to eliminate typos and modify how words are pronounced as needed. For grammars that are based on next-generation models, the service extracts no OOV words from the grammars.
To add a grammar that has the same name as an existing grammar, set the `allow_overwrite` parameter to `true`; otherwise, the request fails. Overwriting an existing grammar causes the service to process the grammar file and extract OOV words anew. Before doing so, it removes any OOV words associated with the existing grammar from the model's words resource unless they were also added by another resource or they have been modified in some way with the Add custom words or Add a custom word method.
For grammars that are based on previous-generation models, the service limits the overall amount of data that you can add to a custom model to a maximum of 10 million total words from all sources combined. Also, you can add no more than 90 thousand OOV words to a model. This includes words that the service extracts from corpora and grammars and words that you add directly.
See also:
- Understanding grammars
- Add a grammar to the custom language model
- Language support for customization">
Add a grammar
POST /v1/customizations/{customization_id}/grammars/{grammar_name}
Adds a single grammar file to a custom language model. Submit a plain text file in UTF-8 format that defines the grammar. Use multiple requests to submit multiple grammar files. You must use credentials for the instance of the service that owns a model to add a grammar to it. Adding a grammar does not affect the custom language model until you train the model for the new data by using the Train a custom language model method.
The call returns an HTTP 201 response code if the grammar is valid. The service then asynchronously processes the contents of the grammar and automatically extracts new words that it finds. This operation can take a few seconds or minutes to complete depending on the size and complexity of the grammar, as well as the current load on the service. You cannot submit requests to add additional resources to the custom model or to train the model until the service's analysis of the grammar for the current request completes. Use the Get a grammar method to check the status of the analysis.
For grammars that are based on previous-generation models, the service populates the model's words resource with any word that is recognized by the grammar that is not found in the model's base vocabulary. These are referred to as out-of-vocabulary (OOV) words. You can use the List custom words method to examine the words resource and use other words-related methods to eliminate typos and modify how words are pronounced as needed. For grammars that are based on next-generation models, the service extracts no OOV words from the grammars.
To add a grammar that has the same name as an existing grammar, set the `allow_overwrite` parameter to `true`; otherwise, the request fails. Overwriting an existing grammar causes the service to process the grammar file and extract OOV words anew. Before doing so, it removes any OOV words associated with the existing grammar from the model's words resource unless they were also added by another resource or they have been modified in some way with the Add custom words or Add a custom word method.
For grammars that are based on previous-generation models, the service limits the overall amount of data that you can add to a custom model to a maximum of 10 million total words from all sources combined. Also, you can add no more than 90 thousand OOV words to a model. This includes words that the service extracts from corpora and grammars and words that you add directly.
See also:
- Understanding grammars
- Add a grammar to the custom language model
- Language support for customization
Request
Request Body
A plain text file that contains the grammar in the format specified by the `Content-Type` header. Encode the file in UTF-8 (ASCII is a subset of UTF-8). Using any other encoding can lead to issues when compiling the grammar or to unexpected results in decoding. The service ignores an encoding that is specified in the header of the grammar.
With the `curl` command, use the `--data-binary` option to upload the file for the request.
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
grammar_name
Required *
string
The name of the new grammar for the custom language model. Use a localized name that matches the language of the custom model and reflects the contents of the grammar.
- Include a maximum of 128 characters in the name.
- Do not use characters that need to be URL-encoded. For example, do not use spaces, slashes, backslashes, colons, ampersands, double quotes, plus signs, equals signs, questions marks, and so on in the name. (The service does not prevent the use of these characters. But because they must be URL-encoded wherever used, their use is strongly discouraged.)
- Do not use the name of an existing grammar or corpus that is already defined for the custom model.
- Do not use the name `user`, which is reserved by the service to denote custom words that are added or modified by the user.
- Do not use the name `base_lm` or `default_lm`. Both names are reserved for future use by the service.
Query Parameters
allow_overwrite
boolean
If `true`, the specified grammar overwrites an existing grammar with the same name. If `false`, the request fails if a grammar with the same name already exists. The parameter has no effect if a grammar with the same name does not already exist.
Response
201 - Created. Addition of the grammar was successfully started. The service is analyzing the data.
400 - Bad Request. A required parameter is null or invalid, the specified grammar name already exists, or the custom model needs to be upgraded, among other possibilities. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Grammar file not specified or empty`
- `Grammar '{grammar_name}' already exists - change its name, remove existing grammar before adding new one, or overwrite existing grammar by setting 'allow_overwrite' to 'true'`
- `Corpus exists with grammar name '{grammar_name}'. Please use different name.`
- `TOTAL_NUMBER_OF_OOV_WORDS_EXCEEDS_MAXIMUM_ALLOWED_FORMAT: "Total number of OOV words {total_number} exceeds {maximum_allowed}"`
- `Analysis of grammar '{grammar_name}' failed due to {error_message}. Please fix the error then add the grammar again by setting the 'allow_overwrite' flag to 'true'.`, where `{error_message}` is a message of the form `{"code": 404, "error": "Model en-US_BroadbandModel (version: en-US_BroadbandModel.{version}) not found", "code_description": "Not Found"}`. Upgrade the custom language model to the latest version of its base language model, and then add the grammar to the custom model.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
405 - Method Not Allowed. The grammar name includes characters that need to be URL-encoded.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
415 - Unsupported Media Type. The request specified an unacceptable media type.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. An internal error prevented the service from satisfying the request. You can also receive status code 500 `Forwarding Error` if the service is currently busy handling a previous request for the custom model.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Get a grammar
GET /v1/customizations/{customization_id}/grammars/{grammar_name}
Gets information about a grammar from a custom language model. For each grammar, the information includes the name, status, and (for grammars that are based on previous-generation models) the total number of out-of-vocabulary (OOV) words. You must use credentials for the instance of the service that owns a model to list its grammars.
See also:
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
grammar_name
Required *
string
The name of the grammar for the custom language model.
Query Parameters
Response
200 - OK. The request succeeded.
name
string
The name of the grammar.
out_of_vocabulary_words
integer
For custom models that are based on previous-generation models, the number of OOV words extracted from the grammar. The value is `0` while the grammar is being processed.
For custom models that are based on next-generation models, no OOV words are extracted from grammars, so the value is always `0`.
status
string
The status of the grammar:
- `analyzed`: The service successfully analyzed the grammar. The custom model can be trained with data from the grammar.
- `being_processed`: The service is still analyzing the grammar. The service cannot accept requests to add new resources or to train the custom model.
- `undetermined`: The service encountered an error while processing the grammar. The `error` field describes the failure.
error
string
If the status of the grammar is `undetermined`, the following message: `Analysis of grammar '{grammar_name}' failed. Please try fixing the error or adding the grammar again by setting the 'allow_overwrite' flag to 'true'.`
400 - Bad Request. The specified customization ID or grammar name is invalid, including the case where the grammar does not exist for the custom model. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Invalid value for grammar name '{grammar_name}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Delete a grammar
DELETE /v1/customizations/{customization_id}/grammars/{grammar_name}
Deletes an existing grammar from a custom language model. For grammars that are based on previous-generation models, the service removes any out-of-vocabulary (OOV) words associated with the grammar from the custom model's words resource unless they were also added by another resource or they were modified in some way with the Add custom words or Add a custom word method. Removing a grammar does not affect the custom model until you train the model with the Train a custom language model method. You must use credentials for the instance of the service that owns a model to delete its grammar.
See also:
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom language model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
grammar_name
Required *
string
The name of the grammar for the custom language model.
Query Parameters
Response
200 - OK. The grammar was successfully deleted from the custom language model.
400 - Bad Request. The specified customization ID or grammar name is invalid, including the case where the grammar does not exist for the custom model. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Invalid value for grammar name '{grammar_name}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
405 - Method Not Allowed. No grammar name was specified with the request.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
See also: Create a custom acoustic model.">
Create a custom acoustic model
POST /v1/acoustic_customizations
Creates a new custom acoustic model for a specified base model. The custom acoustic model can be used only with the base model for which it is created. The model is owned by the instance of the service whose credentials are used to create it.
You can create a maximum of 1024 custom acoustic models per owning credentials. The service returns an error if you attempt to create more than 1024 models. You do not lose any models, but you cannot create any more until your model count is below the limit.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
Important: Effective 31 July 2023, all previous-generation models will be removed from the service and the documentation. Most previous-generation models were deprecated on 15 March 2022. You must migrate to the equivalent large speech model or next-generation model by 31 July 2023. For more information, see Migrating to large speech models.
See also: Create a custom acoustic model.
Request
Request Body
CreateAcousticModel
A `CreateAcousticModel` object that provides basic information about the new custom acoustic model.
name
Required *
string
A user-defined name for the new custom acoustic model. Use a localized name that matches the language of the custom model. Use a name that describes the acoustic environment of the custom model, such as `Mobile custom model` or `Noisy car custom model`. Use a name that is unique among all custom acoustic models that you own.
Include a maximum of 256 characters in the name. Do not use backslashes, slashes, colons, equal signs, ampersands, or question marks in the name.
base_model_name
Required *
string
The name of the base language model that is to be customized by the new custom acoustic model. The new custom model can be used only with the base model that it customizes.
To determine whether a base model supports acoustic model customization, refer to Language support for customization.
description
string
A recommended description of the new custom acoustic model. Use a localized description that matches the language of the custom model. Include a maximum of 128 characters in the description.
Response
201 - Created. The custom acoustic model was successfully created.
customization_id
string
The customization ID (GUID) of the custom acoustic model. The Create a custom acoustic model method returns only this field of the object; it does not return the other fields.
created
string
The date and time in Coordinated Universal Time (UTC) at which the custom acoustic model was created. The value is provided in full ISO 8601 format (`YYYY-MM-DDThh:mm:ss.sTZD`).
updated
string
The date and time in Coordinated Universal Time (UTC) at which the custom acoustic model was last modified. The `created` and `updated` fields are equal when an acoustic model is first added but has yet to be updated. The value is provided in full ISO 8601 format (YYYY-MM-DDThh:mm:ss.sTZD).
language
string
The language identifier of the custom acoustic model (for example, `en-US`).
versions
array
A list of the available versions of the custom acoustic model. Each element of the array indicates a version of the base model with which the custom model can be used. Multiple versions exist only if the custom model has been upgraded to a new version of its base model. Otherwise, only a single version is shown.
owner
string
The GUID of the credentials for the instance of the service that owns the custom acoustic model.
name
string
The name of the custom acoustic model.
description
string
The description of the custom acoustic model.
base_model_name
string
The name of the language model for which the custom acoustic model was created.
status
string
The current status of the custom acoustic model:
- `pending`: The model was created but is waiting either for valid training data to be added or for the service to finish analyzing added data.
- `ready`: The model contains valid data and is ready to be trained. If the model contains a mix of valid and invalid resources, you need to set the `strict` parameter to `false` for the training to proceed.
- `training`: The model is currently being trained.
- `available`: The model is trained and ready to use.
- `upgrading`: The model is currently being upgraded.
- `failed`: Training of the model failed.
progress
integer
A percentage that indicates the progress of the custom acoustic model's current training. A value of `100` means that the model is fully trained. Note: The `progress` field does not currently reflect the progress of the training. The field changes from `0` to `100` when training is complete.
warnings
string
If the request included unknown parameters, the following message: `Unexpected query parameter(s) ['parameters'] detected`, where `parameters` is a list that includes a quoted string for each unknown parameter.
400 - Bad Request. A required parameter is null or invalid. Specific failure messages include:
- `Required parameter '{name}' is missing`
- `Required parameter '{name}' cannot be empty string`
- `Required parameter '{name}' cannot be null`
- `The base model '{model_name}' is not recognized`
- `Acoustic customization is not supported for base model '{model_name}'`
- `You exceeded the maximum '{model_number}' of allowed custom acoustic models. You have '{model_number}' custom acoustic models. Please remove the models you do not need or contact the IBM speech support team to apply for an exception.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
List custom acoustic models
GET /v1/acoustic_customizations
Lists information about all custom acoustic models that are owned by an instance of the service. Use the `language` parameter to see all custom acoustic models for the specified language. Omit the parameter to see all custom acoustic models for all languages. You must use credentials for the instance of the service that owns a model to list information about it.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also: Listing custom acoustic models.
Request
Path Parameters
Query Parameters
language
string
The identifier of the language for which custom language or custom acoustic models are to be returned. Specify the five-character language identifier; for example, specify `en-US` to see all custom language or custom acoustic models that are based on US English models. Omit the parameter to see all custom language or custom acoustic models that are owned by the requesting credentials.
To determine the languages for which customization is available, see Language support for customization.
Response
200 - OK. The request succeeded.
customizations
array
An array of `AcousticModel` objects that provides information about each available custom acoustic model. The array is empty if the requesting credentials own no custom acoustic models (if no language is specified) or own no custom acoustic models for the specified language.
400 - Bad Request. A required parameter is null or invalid. Specific failure messages include:
- `Language '{language}' is not supported for customization`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Get a custom acoustic model
GET /v1/acoustic_customizations/{customization_id}
Gets information about a specified custom acoustic model. You must use credentials for the instance of the service that owns a model to list information about it.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also: Listing custom acoustic models.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom acoustic model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
Response
200 - OK. The request succeeded.
customization_id
string
The customization ID (GUID) of the custom acoustic model. The Create a custom acoustic model method returns only this field of the object; it does not return the other fields.
created
string
The date and time in Coordinated Universal Time (UTC) at which the custom acoustic model was created. The value is provided in full ISO 8601 format (`YYYY-MM-DDThh:mm:ss.sTZD`).
updated
string
The date and time in Coordinated Universal Time (UTC) at which the custom acoustic model was last modified. The `created` and `updated` fields are equal when an acoustic model is first added but has yet to be updated. The value is provided in full ISO 8601 format (YYYY-MM-DDThh:mm:ss.sTZD).
language
string
The language identifier of the custom acoustic model (for example, `en-US`).
versions
array
A list of the available versions of the custom acoustic model. Each element of the array indicates a version of the base model with which the custom model can be used. Multiple versions exist only if the custom model has been upgraded to a new version of its base model. Otherwise, only a single version is shown.
owner
string
The GUID of the credentials for the instance of the service that owns the custom acoustic model.
name
string
The name of the custom acoustic model.
description
string
The description of the custom acoustic model.
base_model_name
string
The name of the language model for which the custom acoustic model was created.
status
string
The current status of the custom acoustic model:
- `pending`: The model was created but is waiting either for valid training data to be added or for the service to finish analyzing added data.
- `ready`: The model contains valid data and is ready to be trained. If the model contains a mix of valid and invalid resources, you need to set the `strict` parameter to `false` for the training to proceed.
- `training`: The model is currently being trained.
- `available`: The model is trained and ready to use.
- `upgrading`: The model is currently being upgraded.
- `failed`: Training of the model failed.
progress
integer
A percentage that indicates the progress of the custom acoustic model's current training. A value of `100` means that the model is fully trained. Note: The `progress` field does not currently reflect the progress of the training. The field changes from `0` to `100` when training is complete.
warnings
string
If the request included unknown parameters, the following message: `Unexpected query parameter(s) ['parameters'] detected`, where `parameters` is a list that includes a quoted string for each unknown parameter.
400 - Bad Request. The specified customization ID is invalid:
- `Malformed GUID: '{customization_id}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Delete a custom acoustic model
DELETE /v1/acoustic_customizations/{customization_id}
Deletes an existing custom acoustic model. The custom model cannot be deleted if another request, such as adding an audio resource to the model, is currently being processed. You must use credentials for the instance of the service that owns a model to delete it.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also: Deleting a custom acoustic model.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom acoustic model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
Response
200 - OK. The custom acoustic model was successfully deleted.
400 - Bad Request. The specified customization ID is invalid:
- `Malformed GUID: '{customization_id}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials, including the case where the custom model does not exist:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
You can use the optional `custom_language_model_id` parameter to specify the GUID of a separately created custom language model that is to be used during training. Train with a custom language model if you have verbatim transcriptions of the audio files that you have added to the custom model or you have either corpora (text files) or a list of words that are relevant to the contents of the audio files. For training to succeed, both of the custom models must be based on the same version of the same base model, and the custom language model must be fully trained and available.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also:
Training failures
Training can fail to start for the following reasons:
- The service is currently handling another request for the custom model, such as another training request or a request to add audio resources to the model.
- The custom model contains less than 10 minutes of audio that includes speech, not silence.
- The custom model contains more than 50 hours of audio (for IBM Cloud) or more that 200 hours of audio (for IBM Cloud Pak for Data). Note: For IBM Cloud, the maximum hours of audio for a custom acoustic model was reduced from 200 to 50 hours in August and September 2022. For more information, see Maximum hours of audio.
- You passed a custom language model with the `custom_language_model_id` query parameter that is not in the available state. A custom language model must be fully trained and available to be used to train a custom acoustic model.
- You passed an incompatible custom language model with the `custom_language_model_id` query parameter. Both custom models must be based on the same version of the same base model.
- The custom model contains one or more invalid audio resources. You can correct the invalid audio resources or set the `strict` parameter to `false` to exclude the invalid resources from the training. The model must contain at least one valid resource for training to succeed.">
Train a custom acoustic model
POST /v1/acoustic_customizations/{customization_id}/train
Initiates the training of a custom acoustic model with new or changed audio resources. After adding or deleting audio resources for a custom acoustic model, use this method to begin the actual training of the model on the latest audio data. The custom acoustic model does not reflect its changed data until you train it. You must use credentials for the instance of the service that owns a model to train it.
The training method is asynchronous. Training time depends on the cumulative amount of audio data that the custom acoustic model contains and the current load on the service. When you train or retrain a model, the service uses all of the model's audio data in the training. Training a custom acoustic model takes approximately as long as the length of its cumulative audio data. For example, it takes approximately 2 hours to train a model that contains a total of 2 hours of audio. The method returns an HTTP 200 response code to indicate that the training process has begun.
You can monitor the status of the training by using the Get a custom acoustic model method to poll the model's status. Use a loop to check the status once a minute. The method returns an `AcousticModel` object that includes `status` and `progress` fields. A status of `available` indicates that the custom model is trained and ready to use. The service cannot train a model while it is handling another request for the model. The service cannot accept subsequent training requests, or requests to add new audio resources, until the existing training request completes.
You can use the optional `custom_language_model_id` parameter to specify the GUID of a separately created custom language model that is to be used during training. Train with a custom language model if you have verbatim transcriptions of the audio files that you have added to the custom model or you have either corpora (text files) or a list of words that are relevant to the contents of the audio files. For training to succeed, both of the custom models must be based on the same version of the same base model, and the custom language model must be fully trained and available.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also:
Training failures
Training can fail to start for the following reasons:
- The service is currently handling another request for the custom model, such as another training request or a request to add audio resources to the model.
- The custom model contains less than 10 minutes of audio that includes speech, not silence.
- The custom model contains more than 50 hours of audio (for IBM Cloud) or more that 200 hours of audio (for IBM Cloud Pak for Data). Note: For IBM Cloud, the maximum hours of audio for a custom acoustic model was reduced from 200 to 50 hours in August and September 2022. For more information, see Maximum hours of audio.
- You passed a custom language model with the `custom_language_model_id` query parameter that is not in the available state. A custom language model must be fully trained and available to be used to train a custom acoustic model.
- You passed an incompatible custom language model with the `custom_language_model_id` query parameter. Both custom models must be based on the same version of the same base model.
- The custom model contains one or more invalid audio resources. You can correct the invalid audio resources or set the `strict` parameter to `false` to exclude the invalid resources from the training. The model must contain at least one valid resource for training to succeed.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom acoustic model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
custom_language_model_id
string
The customization ID (GUID) of a custom language model that is to be used during training of the custom acoustic model. Specify a custom language model that has been trained with verbatim transcriptions of the audio resources or that contains words that are relevant to the contents of the audio resources. The custom language model must be based on the same version of the same base model as the custom acoustic model, and the custom language model must be fully trained and available. The credentials specified with the request must own both custom models.
strict
boolean
If `false`, allows training of the custom acoustic model to proceed as long as the model contains at least one valid audio resource. The method returns an array of `TrainingWarning` objects that lists any invalid resources. By default (`true`), training of a custom acoustic model fails (status code 400) if the model contains one or more invalid audio resources.
Response
200 - OK. Training of the custom acoustic model started successfully.
warnings
array
An array of `TrainingWarning` objects that lists any invalid resources contained in the custom model. For custom language models, invalid resources are grouped and identified by type of resource. The method can return warnings only if the `strict` parameter is set to `false`.
400 - Bad Request. A required parameter is null or invalid, or the custom model is not ready to be trained. Specific failure messages include:
- `No input data modified since last training`
- `The following audio resources are invalid: '{resources}'. Fix errors before training.`
- `Malformed GUID: '{customization_id}'`
- `The specified custom language model '{customization_id}' is not ready for AM training and/or upgrade. Please make sure it is trained and available.`
- `Failed to train. No base model version found in the catalog to match amVersion='{base_model_version}' of the acoustic custom model '{customization_id}' and lmVersion='{base_model_version}' of passed language custom model '{customization_id}'. Upgrading the acoustic custom model may help.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Reset a custom acoustic model
POST /v1/acoustic_customizations/{customization_id}/reset
Resets a custom acoustic model by removing all audio resources from the model. Resetting a custom acoustic model initializes the model to its state when it was first created. Metadata such as the name and language of the model are preserved, but the model's audio resources are removed and must be re-created. The service cannot reset a model while it is handling another request for the model. The service cannot accept subsequent requests for the model until the existing reset request completes. You must use credentials for the instance of the service that owns a model to reset it.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also: Resetting a custom acoustic model.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom acoustic model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
Response
200 - OK. The custom acoustic model was successfully reset.
400 - Bad Request. The specified customization ID is invalid:
- `Malformed GUID: '{customization_id}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
While it is being upgraded, the custom model has the status `upgrading`. When the upgrade is complete, the model resumes the status that it had prior to upgrade. The service cannot upgrade a model while it is handling another request for the model. The service cannot accept subsequent requests for the model until the existing upgrade request completes.
If the custom acoustic model was trained with a separately created custom language model, you must use the `custom_language_model_id` parameter to specify the GUID of that custom language model. The custom language model must be upgraded before the custom acoustic model can be upgraded. Omit the parameter if the custom acoustic model was not trained with a custom language model.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also: Upgrading a custom acoustic model.">
Upgrade a custom acoustic model
POST /v1/acoustic_customizations/{customization_id}/upgrade_model
Initiates the upgrade of a custom acoustic model to the latest version of its base language model. The upgrade method is asynchronous. It can take on the order of minutes or hours to complete depending on the amount of data in the custom model and the current load on the service; typically, upgrade takes approximately twice the length of the total audio contained in the custom model. A custom model must be in the `ready` or `available` state to be upgraded. You must use credentials for the instance of the service that owns a model to upgrade it.
The method returns an HTTP 200 response code to indicate that the upgrade process has begun successfully. You can monitor the status of the upgrade by using the Get a custom acoustic model method to poll the model's status. The method returns an `AcousticModel` object that includes `status` and `progress` fields. Use a loop to check the status once a minute.
While it is being upgraded, the custom model has the status `upgrading`. When the upgrade is complete, the model resumes the status that it had prior to upgrade. The service cannot upgrade a model while it is handling another request for the model. The service cannot accept subsequent requests for the model until the existing upgrade request completes.
If the custom acoustic model was trained with a separately created custom language model, you must use the `custom_language_model_id` parameter to specify the GUID of that custom language model. The custom language model must be upgraded before the custom acoustic model can be upgraded. Omit the parameter if the custom acoustic model was not trained with a custom language model.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also: Upgrading a custom acoustic model.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom acoustic model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
custom_language_model_id
string
If the custom acoustic model was trained with a custom language model, the customization ID (GUID) of that custom language model. The custom language model must be upgraded before the custom acoustic model can be upgraded. The custom language model must be fully trained and available. The credentials specified with the request must own both custom models.
force
boolean
If `true`, forces the upgrade of a custom acoustic model for which no input data has been modified since it was last trained. Use this parameter only to force the upgrade of a custom acoustic model that is trained with a custom language model, and only if you receive a 400 response code and the message `No input data modified since last training`. See Upgrading a custom acoustic model.
Response
200 - OK. Upgrade of the custom acoustic model started successfully.
400 - Bad Request. A parameter is null or invalid, or the specified custom model cannot be upgraded. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Custom model is up-to-date`
- `No input data available to upgrade the model`
- `No input data modified since last training`
- `Cannot upgrade failed custom model`
- `The passed language custom model needs to be upgraded in order to upgrade the acoustic custom model.`
- `The specified custom language model '{customization_id}' is not ready for AM training and/or upgrade. Please make sure it is trained and available.`
- `Base model name mismatch detected. Please make sure that the base model name of the language custom model matches the base model name of the acoustic custom model.`
- `Invalid model type for customization_id '{customization_id}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
List audio resources
GET /v1/acoustic_customizations/{customization_id}/audio
Lists information about all audio resources from a custom acoustic model. The information includes the name of the resource and information about its audio data, such as its duration. It also includes the status of the audio resource, which is important for checking the service's analysis of the resource in response to a request to add it to the custom acoustic model. You must use credentials for the instance of the service that owns a model to list its audio resources.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also: Listing audio resources for a custom acoustic model.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom acoustic model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
Query Parameters
Response
200 - OK. The request succeeded.
total_minutes_of_audio
number
The total minutes of accumulated audio summed over all of the valid audio resources for the custom acoustic model. You can use this value to determine whether the custom model has too little or too much audio to begin training.
audio
array
An array of `AudioResource` objects that provides information about the audio resources of the custom acoustic model. The array is empty if the custom model has no audio resources.
400 - Bad Request. The specified customization ID is invalid:
- `Malformed GUID: '{customization_id}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
The method is asynchronous. It can take several seconds or minutes to complete depending on the duration of the audio and, in the case of an archive file, the total number of audio files being processed. The service returns a 201 response code if the audio is valid. It then asynchronously analyzes the contents of the audio file or files and automatically extracts information about the audio such as its length, sampling rate, and encoding. You cannot submit requests to train or upgrade the model until the service's analysis of all audio resources for current requests completes.
To determine the status of the service's analysis of the audio, use the Get an audio resource method to poll the status of the audio. The method accepts the customization ID of the custom model and the name of the audio resource, and it returns the status of the resource. Use a loop to check the status of the audio every few seconds until it becomes `ok`.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also: Add audio to the custom acoustic model.
Content types for audio-type resources
You can add an individual audio file in any format that the service supports for speech recognition. For an audio-type resource, use the `Content-Type` parameter to specify the audio format (MIME type) of the audio file, including specifying the sampling rate, channels, and endianness where indicated.
- `audio/alaw` (Specify the sampling rate (`rate`) of the audio.)
- `audio/basic` (Use only with narrowband models.)
- `audio/flac`
- `audio/g729` (Use only with narrowband models.)
- `audio/l16` (Specify the sampling rate (`rate`) and optionally the number of channels (`channels`) and endianness (`endianness`) of the audio.)
- `audio/mp3`
- `audio/mpeg`
- `audio/mulaw` (Specify the sampling rate (`rate`) of the audio.)
- `audio/ogg` (The service automatically detects the codec of the input audio.)
- `audio/ogg;codecs=opus`
- `audio/ogg;codecs=vorbis`
- `audio/wav` (Provide audio with a maximum of nine channels.)
- `audio/webm` (The service automatically detects the codec of the input audio.)
- `audio/webm;codecs=opus`
- `audio/webm;codecs=vorbis`
The sampling rate of an audio file must match the sampling rate of the base model for the custom model: for broadband models, at least 16 kHz; for narrowband models, at least 8 kHz. If the sampling rate of the audio is higher than the minimum required rate, the service down-samples the audio to the appropriate rate. If the sampling rate of the audio is lower than the minimum required rate, the service labels the audio file as `invalid`.
See also: Supported audio formats.
Content types for archive-type resources
You can add an archive file (.zip or .tar.gz file) that contains audio files in any format that the service supports for speech recognition. For an archive-type resource, use the `Content-Type` parameter to specify the media type of the archive file:
- `application/zip` for a .zip file
- `application/gzip` for a .tar.gz file.
When you add an archive-type resource, the `Contained-Content-Type` header is optional depending on the format of the files that you are adding:
- For audio files of type `audio/alaw`, `audio/basic`, `audio/l16`, or `audio/mulaw`, you must use the `Contained-Content-Type` header to specify the format of the contained audio files. Include the `rate`, `channels`, and `endianness` parameters where necessary. In this case, all audio files contained in the archive file must have the same audio format.
- For audio files of all other types, you can omit the `Contained-Content-Type` header. In this case, the audio files contained in the archive file can have any of the formats not listed in the previous bullet. The audio files do not need to have the same format.
Do not use the `Contained-Content-Type` header when adding an audio-type resource.
Naming restrictions for embedded audio files
The name of an audio file that is contained in an archive-type resource can include a maximum of 128 characters. This includes the file extension and all elements of the name (for example, slashes).">
Add an audio resource
POST /v1/acoustic_customizations/{customization_id}/audio/{audio_name}
Adds an audio resource to a custom acoustic model. Add audio content that reflects the acoustic characteristics of the audio that you plan to transcribe. You must use credentials for the instance of the service that owns a model to add an audio resource to it. Adding audio data does not affect the custom acoustic model until you train the model for the new data by using the Train a custom acoustic model method.
You can add individual audio files or an archive file that contains multiple audio files. Adding multiple audio files via a single archive file is significantly more efficient than adding each file individually. You can add audio resources in any format that the service supports for speech recognition.
You can use this method to add any number of audio resources to a custom model by calling the method once for each audio or archive file. You can add multiple different audio resources at the same time. You must add a minimum of 10 minutes of audio that includes speech, not just silence, to a custom acoustic model before you can train it. No audio resource, audio- or archive-type, can be larger than 100 MB. To add an audio resource that has the same name as an existing audio resource, set the `allow_overwrite` parameter to `true`; otherwise, the request fails. A custom model can contain no more than 50 hours of audio (for IBM Cloud) or 200 hours of audio (for IBM Cloud Pak for Data). Note: For IBM Cloud, the maximum hours of audio for a custom acoustic model was reduced from 200 to 50 hours in August and September 2022. For more information, see Maximum hours of audio.
The method is asynchronous. It can take several seconds or minutes to complete depending on the duration of the audio and, in the case of an archive file, the total number of audio files being processed. The service returns a 201 response code if the audio is valid. It then asynchronously analyzes the contents of the audio file or files and automatically extracts information about the audio such as its length, sampling rate, and encoding. You cannot submit requests to train or upgrade the model until the service's analysis of all audio resources for current requests completes.
To determine the status of the service's analysis of the audio, use the Get an audio resource method to poll the status of the audio. The method accepts the customization ID of the custom model and the name of the audio resource, and it returns the status of the resource. Use a loop to check the status of the audio every few seconds until it becomes `ok`.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also: Add audio to the custom acoustic model.
Content types for audio-type resources
You can add an individual audio file in any format that the service supports for speech recognition. For an audio-type resource, use the `Content-Type` parameter to specify the audio format (MIME type) of the audio file, including specifying the sampling rate, channels, and endianness where indicated.
- `audio/alaw` (Specify the sampling rate (`rate`) of the audio.)
- `audio/basic` (Use only with narrowband models.)
- `audio/flac`
- `audio/g729` (Use only with narrowband models.)
- `audio/l16` (Specify the sampling rate (`rate`) and optionally the number of channels (`channels`) and endianness (`endianness`) of the audio.)
- `audio/mp3`
- `audio/mpeg`
- `audio/mulaw` (Specify the sampling rate (`rate`) of the audio.)
- `audio/ogg` (The service automatically detects the codec of the input audio.)
- `audio/ogg;codecs=opus`
- `audio/ogg;codecs=vorbis`
- `audio/wav` (Provide audio with a maximum of nine channels.)
- `audio/webm` (The service automatically detects the codec of the input audio.)
- `audio/webm;codecs=opus`
- `audio/webm;codecs=vorbis`
The sampling rate of an audio file must match the sampling rate of the base model for the custom model: for broadband models, at least 16 kHz; for narrowband models, at least 8 kHz. If the sampling rate of the audio is higher than the minimum required rate, the service down-samples the audio to the appropriate rate. If the sampling rate of the audio is lower than the minimum required rate, the service labels the audio file as `invalid`.
See also: Supported audio formats.
Content types for archive-type resources
You can add an archive file (.zip or .tar.gz file) that contains audio files in any format that the service supports for speech recognition. For an archive-type resource, use the `Content-Type` parameter to specify the media type of the archive file:
- `application/zip` for a .zip file
- `application/gzip` for a .tar.gz file.
When you add an archive-type resource, the `Contained-Content-Type` header is optional depending on the format of the files that you are adding:
- For audio files of type `audio/alaw`, `audio/basic`, `audio/l16`, or `audio/mulaw`, you must use the `Contained-Content-Type` header to specify the format of the contained audio files. Include the `rate`, `channels`, and `endianness` parameters where necessary. In this case, all audio files contained in the archive file must have the same audio format.
- For audio files of all other types, you can omit the `Contained-Content-Type` header. In this case, the audio files contained in the archive file can have any of the formats not listed in the previous bullet. The audio files do not need to have the same format.
Do not use the `Contained-Content-Type` header when adding an audio-type resource.
Naming restrictions for embedded audio files
The name of an audio file that is contained in an archive-type resource can include a maximum of 128 characters. This includes the file extension and all elements of the name (for example, slashes).
Request
Request Body
The audio resource that is to be added to the custom acoustic model, an individual audio file or an archive file.
With the `curl` command, use the `--data-binary` option to upload the file for the request.
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom acoustic model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
audio_name
Required *
string
The name of the new audio resource for the custom acoustic model. Use a localized name that matches the language of the custom model and reflects the contents of the resource.
- Include a maximum of 128 characters in the name.
- Do not use characters that need to be URL-encoded. For example, do not use spaces, slashes, backslashes, colons, ampersands, double quotes, plus signs, equals signs, questions marks, and so on in the name. (The service does not prevent the use of these characters. But because they must be URL-encoded wherever used, their use is strongly discouraged.)
- Do not use the name of an audio resource that has already been added to the custom model.
Query Parameters
allow_overwrite
boolean
If `true`, the specified audio resource overwrites an existing audio resource with the same name. If `false`, the request fails if an audio resource with the same name already exists. The parameter has no effect if an audio resource with the same name does not already exist.
Response
201 - Created. Addition of the audio resource was successfully started. The service is analyzing the data.
400 - Bad Request. A required parameter is null or invalid, the specified customization ID or audio resource is invalid, or the specified audio resource already exists. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Audio file not specified or empty`
- `Invalid audio format detected`
- `Invalid or missing audio content type`
- `Audio '{name}' already exists - change its name, remove existing file before adding new one, or overwrite existing file by setting 'allow_overwrite' flag to 'true'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
405 - Method Not Allowed. The audio resource name includes characters that need to be URL-encoded.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. An internal error prevented the service from satisfying the request. You can also receive status code 500 `Forwarding Error` if the service is currently busy handling a previous request for the custom model.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Get an audio resource
GET /v1/acoustic_customizations/{customization_id}/audio/{audio_name}
Gets information about an audio resource from a custom acoustic model. The method returns an `AudioListing` object whose fields depend on the type of audio resource that you specify with the method's `audio_name` parameter:
- For an audio-type resource, the object's fields match those of an `AudioResource` object: `duration`, `name`, `details`, and `status`.
- For an archive-type resource, the object includes a `container` field whose fields match those of an `AudioResource` object. It also includes an `audio` field, which contains an array of `AudioResource` objects that provides information about the audio files that are contained in the archive.
The information includes the status of the specified audio resource. The status is important for checking the service's analysis of a resource that you add to the custom model.
- For an audio-type resource, the `status` field is located in the `AudioListing` object.
- For an archive-type resource, the `status` field is located in the `AudioResource` object that is returned in the `container` field.
You must use credentials for the instance of the service that owns a model to list its audio resources.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also: Listing audio resources for a custom acoustic model.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom acoustic model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
audio_name
Required *
string
The name of the audio resource for the custom acoustic model.
Query Parameters
Response
200 - OK. The request succeeded.
duration
integer
For an audio-type resource, the total seconds of audio in the resource. Omitted for an archive-type resource.
name
string
For an audio-type resource, the user-specified name of the resource. Omitted for an archive-type resource.
details
object
Information about an audio resource from a custom acoustic model.
status
string
For an audio-type resource, the status of the resource:
- `ok`: The service successfully analyzed the audio data. The data can be used to train the custom model.
- `being_processed`: The service is still analyzing the audio data. The service cannot accept requests to add new audio resources or to train the custom model until its analysis is complete.
- `invalid`: The audio data is not valid for training the custom model (possibly because it has the wrong format or sampling rate, or because it is corrupted).
Omitted for an archive-type resource.
container
object
Information about an audio resource from a custom acoustic model.
audio
array
For an archive-type resource, an array of `AudioResource` objects that provides information about the audio-type resources that are contained in the resource. Omitted for an audio-type resource.
400 - Bad Request. The specified customization ID or audio resource name is invalid, including the case where the audio resource does not exist for the custom model. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Invalid value for audio name '{audio_name}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also: Deleting an audio resource from a custom acoustic model.">
Delete an audio resource
DELETE /v1/acoustic_customizations/{customization_id}/audio/{audio_name}
Deletes an existing audio resource from a custom acoustic model. Deleting an archive-type audio resource removes the entire archive of files. The service does not allow deletion of individual files from an archive resource.
Removing an audio resource does not affect the custom model until you train the model on its updated data by using the Train a custom acoustic model method. You can delete an existing audio resource from a model while a different resource is being added to the model. You must use credentials for the instance of the service that owns a model to delete its audio resources.
Note: Acoustic model customization is supported only for use with previous-generation models. It is not supported for large speech models and next-generation models.
See also: Deleting an audio resource from a custom acoustic model.
Request
Path Parameters
customization_id
Required *
string
The customization ID (GUID) of the custom acoustic model that is to be used for the request. You must make the request with credentials for the instance of the service that owns the custom model.
audio_name
Required *
string
The name of the audio resource for the custom acoustic model.
Query Parameters
Response
200 - OK. The audio resource was successfully deleted from the custom acoustic model.
400 - Bad Request. The specified customization ID or audio resource name is invalid, including the case where the audio resource does not exist for the custom model. Specific failure messages include:
- `Malformed GUID: '{customization_id}'`
- `Invalid value for audio name '{audio_name}'`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
401 - Unauthorized. The specified credentials are invalid or the specified customization ID is invalid for the requesting credentials:
- `Invalid customization_id '{customization_id}' for user`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
405 - Method Not Allowed. No audio resource name was specified with the request.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
409 - Conflict. The service is currently busy handling a previous request for the custom model:
- `Customization '{customization_id}' is currently locked to process your last request.`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Delete labeled data
DELETE /v1/user_data
Deletes all data that is associated with a specified customer ID. The method deletes all data for the customer ID, regardless of the method by which the information was added. The method has no effect if no data is associated with the customer ID. You must issue the request with credentials for the same instance of the service that was used to associate the customer ID with the data. You associate a customer ID with data by passing the `X-Watson-Metadata` header with a request that passes the data.
Note: If you delete an instance of the service from the service console, all data associated with that service instance is automatically deleted. This includes all custom language models, corpora, grammars, and words; all custom acoustic models and audio resources; all registered endpoints for the asynchronous HTTP interface; and all data related to speech recognition requests.
See also: Information security.
Request
Path Parameters
Query Parameters
customer_id
Required *
string
The customer ID for which all data is to be deleted.
Response
200 - OK. The deletion request was successfully submitted.
400 - Bad Request. The request did not pass a customer ID:
- `No customer ID found in the request`
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
500 - Internal Server Error. The service experienced an internal error.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
503 - Service Unavailable. The service is currently unavailable.
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
array
Warnings associated with the error.
Spoken language identification
POST /v1/detect_language
Detects the spoken language in audio streams. The endpoint is `/v1/detect_language` and user can optionally include `lid_confidence` parameter to set a custom confidence threshold for detection. The model continuously processes incoming audio and returns the identified language when it reaches a confidence level higher than the specified threshold (0.99 by default). See Spoken language identification.
Request
Request Body
Path Parameters
Query Parameters
lid_confidence
Required *
number
Set a custom confidence threshold for detection.
Response
200 - OK. The request succeeded.
results
array
An array of `LanguageDetectionResult` objects
result_index
integer
An index that indicates a change point in the `results` array. The service increments the index for additional results that it sends for new audio for the same request. All results with the same index are delivered at the same time. The same index can include multiple final results that are delivered with the same response.