Skip to content

Commit 0137964

Browse files
author
Anthony Oliveri
committed
feat(SpeechToTextV1): Add languageCustomizationID parameter to createJob() and recognize()
1 parent a2f5258 commit 0137964

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

Source/SpeechToTextV1/SpeechToText.swift

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,12 @@ public class SpeechToText {
256256
- parameter audio: The audio to transcribe in the format specified by the `Content-Type` header.
257257
- parameter contentType: The type of the input.
258258
- parameter model: The identifier of the model that is to be used for the recognition request.
259-
- parameter customizationID: The customization ID (GUID) of a custom language model that is to be used with the
260-
recognition request. The base model of the specified custom language model must match the model specified with
261-
the `model` parameter. You must make the request with service credentials created for the instance of the service
262-
that owns the custom model. By default, no custom language model is used. See [Custom
259+
- parameter languageCustomizationID: The customization ID (GUID) of a custom language model that is to be used
260+
with the recognition request. The base model of the specified custom language model must match the model
261+
specified with the `model` parameter. You must make the request with service credentials created for the instance
262+
of the service that owns the custom model. By default, no custom language model is used. See [Custom
263263
models](https://console.bluemix.net/docs/services/speech-to-text/input.html#custom).
264+
**Note:** Use this parameter instead of the deprecated `customization_id` parameter.
264265
- parameter acousticCustomizationID: The customization ID (GUID) of a custom acoustic model that is to be used
265266
with the recognition request. The base model of the specified custom acoustic model must match the model
266267
specified with the `model` parameter. You must make the request with service credentials created for the instance
@@ -325,13 +326,17 @@ public class SpeechToText {
325326
parameter. To determine whether a language model supports speaker labels, use the **Get models** method and check
326327
that the attribute `speaker_labels` is set to `true`. See [Speaker
327328
labels](https://console.bluemix.net/docs/services/speech-to-text/output.html#speaker_labels).
329+
- parameter customizationID: **Deprecated.** Use the `language_customization_id` parameter to specify the
330+
customization ID (GUID) of a custom language model that is to be used with the recognition request. Do not
331+
specify both parameters with a request.
328332
- parameter headers: A dictionary of request headers to be sent with this request.
329333
- parameter failure: A function executed if an error occurs.
330334
- parameter success: A function executed with the successful result.
331335
*/
332336
public func recognize(
333337
model: String? = nil,
334338
customizationID: String? = nil,
339+
languageCustomizationID: String? = nil,
335340
acousticCustomizationID: String? = nil,
336341
baseModelVersion: String? = nil,
337342
customizationWeight: Double? = nil,
@@ -368,8 +373,8 @@ public class SpeechToText {
368373
let queryParameter = URLQueryItem(name: "model", value: model)
369374
queryParameters.append(queryParameter)
370375
}
371-
if let customizationID = customizationID {
372-
let queryParameter = URLQueryItem(name: "customization_id", value: customizationID)
376+
if let languageCustomizationID = languageCustomizationID {
377+
let queryParameter = URLQueryItem(name: "language_customization_id", value: languageCustomizationID)
373378
queryParameters.append(queryParameter)
374379
}
375380
if let acousticCustomizationID = acousticCustomizationID {
@@ -424,6 +429,10 @@ public class SpeechToText {
424429
let queryParameter = URLQueryItem(name: "speaker_labels", value: "\(speakerLabels)")
425430
queryParameters.append(queryParameter)
426431
}
432+
if let customizationID = customizationID {
433+
let queryParameter = URLQueryItem(name: "customization_id", value: customizationID)
434+
queryParameters.append(queryParameter)
435+
}
427436

428437
// construct REST request
429438
let request = RestRequest(
@@ -662,11 +671,12 @@ public class SpeechToText {
662671
- parameter resultsTtl: The number of minutes for which the results are to be available after the job has
663672
finished. If not delivered via a callback, the results must be retrieved within this time. Omit the parameter to
664673
use a time to live of one week. The parameter is valid with or without a callback URL.
665-
- parameter customizationID: The customization ID (GUID) of a custom language model that is to be used with the
666-
recognition request. The base model of the specified custom language model must match the model specified with
667-
the `model` parameter. You must make the request with service credentials created for the instance of the service
668-
that owns the custom model. By default, no custom language model is used. See [Custom
674+
- parameter languageCustomizationID: The customization ID (GUID) of a custom language model that is to be used
675+
with the recognition request. The base model of the specified custom language model must match the model
676+
specified with the `model` parameter. You must make the request with service credentials created for the instance
677+
of the service that owns the custom model. By default, no custom language model is used. See [Custom
669678
models](https://console.bluemix.net/docs/services/speech-to-text/input.html#custom).
679+
**Note:** Use this parameter instead of the deprecated `customization_id` parameter.
670680
- parameter acousticCustomizationID: The customization ID (GUID) of a custom acoustic model that is to be used
671681
with the recognition request. The base model of the specified custom acoustic model must match the model
672682
specified with the `model` parameter. You must make the request with service credentials created for the instance
@@ -731,6 +741,9 @@ public class SpeechToText {
731741
parameter. To determine whether a language model supports speaker labels, use the **Get models** method and check
732742
that the attribute `speaker_labels` is set to `true`. See [Speaker
733743
labels](https://console.bluemix.net/docs/services/speech-to-text/output.html#speaker_labels).
744+
- parameter customizationID: **Deprecated.** Use the `language_customization_id` parameter to specify the
745+
customization ID (GUID) of a custom language model that is to be used with the recognition request. Do not
746+
specify both parameters with a request.
734747
- parameter headers: A dictionary of request headers to be sent with this request.
735748
- parameter failure: A function executed if an error occurs.
736749
- parameter success: A function executed with the successful result.
@@ -744,6 +757,7 @@ public class SpeechToText {
744757
userToken: String? = nil,
745758
resultsTtl: Int? = nil,
746759
customizationID: String? = nil,
760+
languageCustomizationID: String? = nil,
747761
acousticCustomizationID: String? = nil,
748762
baseModelVersion: String? = nil,
749763
customizationWeight: Double? = nil,
@@ -794,8 +808,8 @@ public class SpeechToText {
794808
let queryParameter = URLQueryItem(name: "results_ttl", value: "\(resultsTtl)")
795809
queryParameters.append(queryParameter)
796810
}
797-
if let customizationID = customizationID {
798-
let queryParameter = URLQueryItem(name: "customization_id", value: customizationID)
811+
if let languageCustomizationID = languageCustomizationID {
812+
let queryParameter = URLQueryItem(name: "language_customization_id", value: languageCustomizationID)
799813
queryParameters.append(queryParameter)
800814
}
801815
if let acousticCustomizationID = acousticCustomizationID {
@@ -850,6 +864,10 @@ public class SpeechToText {
850864
let queryParameter = URLQueryItem(name: "speaker_labels", value: "\(speakerLabels)")
851865
queryParameters.append(queryParameter)
852866
}
867+
if let customizationID = customizationID {
868+
let queryParameter = URLQueryItem(name: "customization_id", value: customizationID)
869+
queryParameters.append(queryParameter)
870+
}
853871

854872
// construct REST request
855873
let request = RestRequest(

0 commit comments

Comments
 (0)