You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(speech-to-text): remove compatibility layer for speech to text
BREAKING CHANGE: Deprecated methods in Speech to Text are no longer available. Changed parameter names are no longer interally corrected.
To migrate your code, use the methods and parameters currently available with the service as documented here: https://www.ibm.com/watson/developercloud/speech-to-text/api/v1/node.html?node
Copy file name to clipboardExpand all lines: speech-to-text/v1.ts
+5-284Lines changed: 5 additions & 284 deletions
Original file line number
Diff line number
Diff line change
@@ -92,129 +92,6 @@ class SpeechToTextV1 extends GeneratedSpeechToTextV1 {
92
92
super(options);
93
93
}
94
94
95
-
96
-
97
-
getModels(params,callback){
98
-
console.warn("WARNING: getModels() was renamed to listModels(). Support for getModels() will be removed in the next major release");
99
-
returnsuper.listModels(params,callback);
100
-
}
101
-
102
-
getCustomization(params,callback){
103
-
console.warn("WARNING: getCustomization() was renamed to getLanguageModel(). Support for getCustomization() will be removed in the next major release");
104
-
returnsuper.getLanguageModel(params,callback);
105
-
}
106
-
107
-
getRecognitionJob(params,callback){
108
-
console.warn("WARNING: getRecognitionJob() was renamed to checkJob(). Support for getRecognitionJob() will be removed in the next major release");
109
-
returnsuper.checkJob(params,callback);
110
-
}
111
-
112
-
createCustomization(params,callback){
113
-
console.warn("WARNING: createCustomization() was renamed to createLanguageModel(). Support for createCustomization() will be removed in the next major release");
114
-
if(params&&!params.content_type){
115
-
params.content_type='application/json';
116
-
}
117
-
returnsuper.createLanguageModel(params,callback);
118
-
}
119
-
120
-
getRecognitionJobs(params,callback){
121
-
console.warn("WARNING: getRecognitionJobs() was renamed to checkJobs(). Support for getRecognitionJobs() will be removed in the next major release");
122
-
returnsuper.checkJobs(params,callback);
123
-
}
124
-
125
-
deleteRecognitionJob(params,callback){
126
-
console.warn("WARNING: deleteRecognitionJob() was renamed to deleteJob(). Support for deleteRecognitionJob() will be removed in the next major release");
127
-
returnsuper.deleteJob(params,callback);
128
-
}
129
-
130
-
getCustomizations(params,callback){
131
-
console.warn("WARNING: getCustomizations() was renamed to listLanguageModels(). Support for getCustomizations() will be removed in the next major release");
132
-
returnsuper.listLanguageModels(params,callback);
133
-
}
134
-
135
-
createRecognitionJob(params,callback){
136
-
console.warn("WARNING: createRecognitionJob() was renamed to createJob(). Support for createRecognitionJob() will be removed in the next major release");
137
-
if(params&&Array.isArray(params.events)){
138
-
params.events=params.events.join(',');
139
-
}
140
-
returnsuper.createJob(params,callback);
141
-
}
142
-
143
-
addCorpus(params,callback){
144
-
if(params&¶ms.name){
145
-
params.corpus_name=params.name;
146
-
}
147
-
if(params&¶ms.corpus){
148
-
params.corpus_file=params.corpus;
149
-
}
150
-
returnsuper.addCorpus(params,callback);
151
-
}
152
-
153
-
getCorpus(params,callback){
154
-
if(params&¶ms.name){
155
-
params.corpus_name=params.name;
156
-
}
157
-
returnsuper.getCorpus(params,callback);
158
-
}
159
-
160
-
deleteCorpus(params,callback){
161
-
if(params&¶ms.name){
162
-
params.corpus_name=params.name;
163
-
}
164
-
returnsuper.deleteCorpus(params,callback);
165
-
}
166
-
167
-
getCorpora(params,callback){
168
-
console.warn("WARNING: getCorpora() was renamed to listCorpora(). Support for getCorpora() will be removed in the next major release");
169
-
returnsuper.listCorpora(params,callback);
170
-
}
171
-
172
-
addWords(params,callback){
173
-
if(params&&!params.content_type){
174
-
params.content_type='application/json';
175
-
}
176
-
returnsuper.addWords(params,callback);
177
-
}
178
-
179
-
addWord(params,callback){
180
-
if(params&¶ms.word){
181
-
params.word_name=params.word;
182
-
}
183
-
if(params&&!params.content_type){
184
-
params.content_type='application/json';
185
-
}
186
-
returnsuper.addWord(params,callback);
187
-
}
188
-
189
-
getWords(params,callback){
190
-
console.warn("WARNING: getWords() was renamed to listWords(). Support for getWords() will be removed in the next major release");
191
-
returnsuper.listWords(params,callback);
192
-
}
193
-
194
-
getWord(params,callback){
195
-
if(params&¶ms.word){
196
-
params.word_name=params.word;
197
-
}
198
-
returnsuper.getWord(params,callback);
199
-
}
200
-
201
-
deleteWord(params,callback){
202
-
if(params&¶ms.word){
203
-
params.word_name=params.word;
204
-
}
205
-
returnsuper.deleteWord(params,callback);
206
-
}
207
-
208
-
trainCustomization(params,callback){
209
-
console.warn("WARNING: trainCustomization() was renamed to trainLanguageModel(). Support for trainCustomization() will be removed in the next major release");
210
-
returnsuper.trainLanguageModel(params,callback);
211
-
}
212
-
213
-
resetCustomization(params,callback){
214
-
console.warn("WARNING: resetCustomization() was renamed to resetLanguageModel(). Support for resetCustomization() will be removed in the next major release");
215
-
returnsuper.resetLanguageModel(params,callback);
216
-
}
217
-
218
95
/**
219
96
* Waits while corpora analysis status is 'being_processes', fires callback once the status is 'analyzed'
220
97
*
@@ -234,7 +111,7 @@ class SpeechToTextV1 extends GeneratedSpeechToTextV1 {
234
111
[
235
112
// validate that it has at least one corpus
236
113
(next)=>{
237
-
self.getCorpora(params,(err,res)=>{
114
+
self.listCorpora(params,(err,res)=>{
238
115
if(err){
239
116
returnnext(err);
240
117
}
@@ -258,15 +135,15 @@ class SpeechToTextV1 extends GeneratedSpeechToTextV1 {
258
135
params
259
136
);
260
137
options.errorFilter=(err)=>{
261
-
// if it's a timeout error, then getCorpora is called again after params.interval
138
+
// if it's a timeout error, then listCorpora is called again after params.interval
262
139
// otherwise the error is passed back to the user
263
140
// if the params.times limit is reached, the error will be passed to the user regardless
264
141
returnerr.code===SpeechToTextV1.ERR_TIMEOUT;
265
142
};
266
143
async.retry(
267
144
options,
268
145
(done)=>{
269
-
self.getCorpora(params,(err,corpora)=>{
146
+
self.listCorpora(params,(err,corpora)=>{
270
147
if(err){
271
148
done(err);
272
149
}elseif(isProcessing(corpora)){
@@ -296,157 +173,6 @@ class SpeechToTextV1 extends GeneratedSpeechToTextV1 {
296
173
);
297
174
}
298
175
299
-
/**
300
-
* Creates a HTTP/HTTPS request to /recognize and keep the connection open.
301
-
* Sets 'Transfer-Encoding': 'chunked' and prepare the connection to send
302
-
* chunk data.
303
-
*
304
-
* @deprecated use recognizeUsingWebSocket instead
305
-
*
306
-
* @param {Object} params The parameters
307
-
* @param {String} [params.content_type] - The Content-type e.g. audio/l16; rate=48000
308
-
* @param {String} [params.session_id] - The session id
* Replaces recognizeLive & friends with a single 2-way stream over websockets
440
-
*
441
-
* @param {Object} params The parameters
442
-
* @return {RecognizeStream}
443
-
* @deprecated
444
-
*/
445
-
createRecognizeStream(params){
446
-
console.warn("WARNING: createRecognizeStream() was renamed to recognizeUsingWebSocket(). Support for createRecognizeStream() will be removed in the next major release");
447
-
returnthis.recognizeUsingWebSocket(params);
448
-
}
449
-
450
176
/**
451
177
* Use the recognize function with a single 2-way stream over websockets
452
178
*
@@ -554,11 +280,6 @@ class SpeechToTextV1 extends GeneratedSpeechToTextV1 {
554
280
});
555
281
}
556
282
557
-
deleteCustomization(params,callback){
558
-
console.warn("WARNING: deleteCustomization() was renamed to deleteLanguageModel(). Support for deleteCustomization() will be removed in the next major release");
559
-
returnsuper.deleteLanguageModel(params,callback);
560
-
}
561
-
562
283
/**
563
284
* Waits while a customization status is 'pending' or 'training', fires callback once the status is 'ready' or 'available'.
564
285
*
@@ -585,15 +306,15 @@ class SpeechToTextV1 extends GeneratedSpeechToTextV1 {
585
306
params
586
307
);
587
308
options.errorFilter=(err)=>{
588
-
// if it's a timeout error, then getCustomization is called again after params.interval
309
+
// if it's a timeout error, then getLanguageModel is called again after params.interval
589
310
// otherwise the error is passed back to the user
590
311
// if the params.times limit is reached, the error will be passed to the user regardless
0 commit comments