tencentcloud-sdk-asr 1.0.200

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e8982298255e454a5423d5f3ad61fa09bdfff09f
4
+ data.tar.gz: daf6888ea7f583b9091d747f23b4ad24bf815828
5
+ SHA512:
6
+ metadata.gz: c43da78fa80ba7a65eb81dd2f1a9e26bb5cc6e0285576917889661337d261374587c5d19a33cd2809d019d9588dce7bf7bd1b86b79064fd2ca4f6292488afc6b
7
+ data.tar.gz: 15973f02d7f792ccedbc25c2d5816619dc2bcce6f42b9c63884175d8a8e804e8c5f92d833d67c6b46c9f643430c14384a515a6835d6c8b0d2ab8c15b9d889dd7
data/lib/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.200
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tencentcloud-sdk-common'
4
+
5
+ require_relative 'v20190614/client'
6
+ require_relative 'v20190614/models'
7
+
8
+ module TencentCloud
9
+ module Asr
10
+ end
11
+ end
@@ -0,0 +1,519 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'json'
18
+
19
+ module TencentCloud
20
+ module Asr
21
+ module V20190614
22
+ class Client < TencentCloud::Common::AbstractClient
23
+
24
+ def initialize(credential, region, profile = nil)
25
+ api_version = '2019-06-14'
26
+ api_endpoint = 'asr.tencentcloudapi.com'
27
+ sdk_version = 'ASR_' + File.read(File.expand_path('../VERSION', __dir__)).strip
28
+ super(credential, region, api_version, api_endpoint, sdk_version, profile)
29
+ end
30
+
31
+
32
+ # 本接口用于关闭语音流异步识别任务。
33
+
34
+ # @param request: Request instance for CloseAsyncRecognitionTask.
35
+ # @type request: :class:`Tencentcloud::asr::V20190614::CloseAsyncRecognitionTaskRequest`
36
+ # @rtype: :class:`Tencentcloud::asr::V20190614::CloseAsyncRecognitionTaskResponse`
37
+ def CloseAsyncRecognitionTask(request)
38
+ body = send_request('CloseAsyncRecognitionTask', request.serialize)
39
+ response = JSON.parse(body)
40
+ if response['Response'].key?('Error') == false
41
+ model = CloseAsyncRecognitionTaskResponse.new
42
+ model.deserialize(response['Response'])
43
+ model
44
+ else
45
+ code = response['Response']['Error']['Code']
46
+ message = response['Response']['Error']['Message']
47
+ reqid = response['Response']['RequestId']
48
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
49
+ end
50
+ rescue TencentCloud::Common::TencentCloudSDKException => e
51
+ raise e
52
+ rescue StandardError => e
53
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
54
+ end
55
+
56
+ # 用户通过本接口进行热词表的创建。
57
+ # <br>• 默认最多可创建30个热词表。
58
+ # <br>• 每个热词表最多可添加128个词,每个词最长10个字,不能超出限制。
59
+ # <br>• 热词表可以通过数组或者本地文件形式上传。
60
+ # <br>• 本地文件必须为UTF-8编码格式,每行仅添加一个热词且不能包含标点和特殊字符。
61
+ # <br>• 热词权重取值范围为[1,10]之间的整数,权重越大代表该词被识别出来的概率越大。
62
+
63
+ # @param request: Request instance for CreateAsrVocab.
64
+ # @type request: :class:`Tencentcloud::asr::V20190614::CreateAsrVocabRequest`
65
+ # @rtype: :class:`Tencentcloud::asr::V20190614::CreateAsrVocabResponse`
66
+ def CreateAsrVocab(request)
67
+ body = send_request('CreateAsrVocab', request.serialize)
68
+ response = JSON.parse(body)
69
+ if response['Response'].key?('Error') == false
70
+ model = CreateAsrVocabResponse.new
71
+ model.deserialize(response['Response'])
72
+ model
73
+ else
74
+ code = response['Response']['Error']['Code']
75
+ message = response['Response']['Error']['Message']
76
+ reqid = response['Response']['RequestId']
77
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
78
+ end
79
+ rescue TencentCloud::Common::TencentCloudSDKException => e
80
+ raise e
81
+ rescue StandardError => e
82
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
83
+ end
84
+
85
+ # 本接口用于对语音流进行准实时识别,通过异步回调来返回识别结果。适用于直播审核等场景。
86
+ # <br>• 支持rtmp、hls、rtsp等流媒体协议,以及各类基于http协议的直播流
87
+ # <br>• 音频流时长无限制,服务会自动拉取音频流数据,若连续10分钟拉不到流数据时,服务会终止识别任务
88
+ # <br>• 服务通过回调的方式来提供识别结果,用户需要提供CallbackUrl。回调时机为一小段话(最长15秒)回调一次。
89
+ # <br>• 签名方法参考 [公共参数](https://cloud.tencent.com/document/api/1093/35640) 中签名方法v3。
90
+ # <br>• 默认单账号限制并发数为20路,如您有提高并发限制的需求,请提[工单](https://console.cloud.tencent.com/workorder/category)进行咨询。
91
+
92
+ # @param request: Request instance for CreateAsyncRecognitionTask.
93
+ # @type request: :class:`Tencentcloud::asr::V20190614::CreateAsyncRecognitionTaskRequest`
94
+ # @rtype: :class:`Tencentcloud::asr::V20190614::CreateAsyncRecognitionTaskResponse`
95
+ def CreateAsyncRecognitionTask(request)
96
+ body = send_request('CreateAsyncRecognitionTask', request.serialize)
97
+ response = JSON.parse(body)
98
+ if response['Response'].key?('Error') == false
99
+ model = CreateAsyncRecognitionTaskResponse.new
100
+ model.deserialize(response['Response'])
101
+ model
102
+ else
103
+ code = response['Response']['Error']['Code']
104
+ message = response['Response']['Error']['Message']
105
+ reqid = response['Response']['RequestId']
106
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
107
+ end
108
+ rescue TencentCloud::Common::TencentCloudSDKException => e
109
+ raise e
110
+ rescue StandardError => e
111
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
112
+ end
113
+
114
+ # 用户使用该接口可以创建自学习模型,以供识别调用
115
+
116
+ # @param request: Request instance for CreateCustomization.
117
+ # @type request: :class:`Tencentcloud::asr::V20190614::CreateCustomizationRequest`
118
+ # @rtype: :class:`Tencentcloud::asr::V20190614::CreateCustomizationResponse`
119
+ def CreateCustomization(request)
120
+ body = send_request('CreateCustomization', request.serialize)
121
+ response = JSON.parse(body)
122
+ if response['Response'].key?('Error') == false
123
+ model = CreateCustomizationResponse.new
124
+ model.deserialize(response['Response'])
125
+ model
126
+ else
127
+ code = response['Response']['Error']['Code']
128
+ message = response['Response']['Error']['Message']
129
+ reqid = response['Response']['RequestId']
130
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
131
+ end
132
+ rescue TencentCloud::Common::TencentCloudSDKException => e
133
+ raise e
134
+ rescue StandardError => e
135
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
136
+ end
137
+
138
+ # 本接口服务对时长5小时以内的录音文件进行识别,异步返回识别全部结果。
139
+ # • 支持中文普通话、英语、粤语、日语、泰语
140
+ # • 支持通用、音视频领域
141
+ # • 支持wav、mp3、m4a、flv、mp4、wma、3gp、amr、aac、ogg-opus、flac格式
142
+ # • 支持语音 URL 和本地语音文件两种请求方式
143
+ # • 语音 URL 的音频时长不能长于5小时,文件大小不超过512MB
144
+ # • 本地语音文件不能大于5MB
145
+ # • 提交录音文件识别请求后,在5小时内完成识别(半小时内发送超过1000小时录音或者2万条识别任务的除外),识别结果在服务端可保存7天
146
+ # • 支持回调或轮询的方式获取结果,结果获取请参考[ 录音文件识别结果查询](https://cloud.tencent.com/document/product/1093/37822)。
147
+ # • 请求方法为 HTTP POST , Content-Type为"application/json; charset=utf-8"
148
+ # • 签名方法参考 [公共参数](https://cloud.tencent.com/document/api/1093/35640) 中签名方法v3。
149
+ # • 默认接口请求频率限制:20次/秒,如您有提高请求频率限制的需求,请提[工单](https://console.cloud.tencent.com/workorder/category)进行咨询。
150
+
151
+ # @param request: Request instance for CreateRecTask.
152
+ # @type request: :class:`Tencentcloud::asr::V20190614::CreateRecTaskRequest`
153
+ # @rtype: :class:`Tencentcloud::asr::V20190614::CreateRecTaskResponse`
154
+ def CreateRecTask(request)
155
+ body = send_request('CreateRecTask', request.serialize)
156
+ response = JSON.parse(body)
157
+ if response['Response'].key?('Error') == false
158
+ model = CreateRecTaskResponse.new
159
+ model.deserialize(response['Response'])
160
+ model
161
+ else
162
+ code = response['Response']['Error']['Code']
163
+ message = response['Response']['Error']['Message']
164
+ reqid = response['Response']['RequestId']
165
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
166
+ end
167
+ rescue TencentCloud::Common::TencentCloudSDKException => e
168
+ raise e
169
+ rescue StandardError => e
170
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
171
+ end
172
+
173
+ # 用户通过本接口进行热词表的删除。
174
+
175
+ # @param request: Request instance for DeleteAsrVocab.
176
+ # @type request: :class:`Tencentcloud::asr::V20190614::DeleteAsrVocabRequest`
177
+ # @rtype: :class:`Tencentcloud::asr::V20190614::DeleteAsrVocabResponse`
178
+ def DeleteAsrVocab(request)
179
+ body = send_request('DeleteAsrVocab', request.serialize)
180
+ response = JSON.parse(body)
181
+ if response['Response'].key?('Error') == false
182
+ model = DeleteAsrVocabResponse.new
183
+ model.deserialize(response['Response'])
184
+ model
185
+ else
186
+ code = response['Response']['Error']['Code']
187
+ message = response['Response']['Error']['Message']
188
+ reqid = response['Response']['RequestId']
189
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
190
+ end
191
+ rescue TencentCloud::Common::TencentCloudSDKException => e
192
+ raise e
193
+ rescue StandardError => e
194
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
195
+ end
196
+
197
+ # 用户通过该接口可以删除自学习模型
198
+
199
+ # @param request: Request instance for DeleteCustomization.
200
+ # @type request: :class:`Tencentcloud::asr::V20190614::DeleteCustomizationRequest`
201
+ # @rtype: :class:`Tencentcloud::asr::V20190614::DeleteCustomizationResponse`
202
+ def DeleteCustomization(request)
203
+ body = send_request('DeleteCustomization', request.serialize)
204
+ response = JSON.parse(body)
205
+ if response['Response'].key?('Error') == false
206
+ model = DeleteCustomizationResponse.new
207
+ model.deserialize(response['Response'])
208
+ model
209
+ else
210
+ code = response['Response']['Error']['Code']
211
+ message = response['Response']['Error']['Message']
212
+ reqid = response['Response']['RequestId']
213
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
214
+ end
215
+ rescue TencentCloud::Common::TencentCloudSDKException => e
216
+ raise e
217
+ rescue StandardError => e
218
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
219
+ end
220
+
221
+ # 本接口用于查询当前在运行的语音流异步识别任务列表。
222
+ # <br>• 签名方法参考 [公共参数](https://cloud.tencent.com/document/api/1093/35640) 中签名方法v3。
223
+
224
+ # @param request: Request instance for DescribeAsyncRecognitionTasks.
225
+ # @type request: :class:`Tencentcloud::asr::V20190614::DescribeAsyncRecognitionTasksRequest`
226
+ # @rtype: :class:`Tencentcloud::asr::V20190614::DescribeAsyncRecognitionTasksResponse`
227
+ def DescribeAsyncRecognitionTasks(request)
228
+ body = send_request('DescribeAsyncRecognitionTasks', request.serialize)
229
+ response = JSON.parse(body)
230
+ if response['Response'].key?('Error') == false
231
+ model = DescribeAsyncRecognitionTasksResponse.new
232
+ model.deserialize(response['Response'])
233
+ model
234
+ else
235
+ code = response['Response']['Error']['Code']
236
+ message = response['Response']['Error']['Message']
237
+ reqid = response['Response']['RequestId']
238
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
239
+ end
240
+ rescue TencentCloud::Common::TencentCloudSDKException => e
241
+ raise e
242
+ rescue StandardError => e
243
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
244
+ end
245
+
246
+ # 在调用录音文件识别请求接口后,有回调和轮询两种方式获取识别结果。
247
+ # <br>• 当采用回调方式时,识别完成后会将结果通过 POST 请求的形式通知到用户在请求时填写的回调 URL,具体请参见[ 录音识别结果回调 ](https://cloud.tencent.com/document/product/1093/52632)。
248
+ # <br>• 当采用轮询方式时,需要主动提交任务ID来轮询识别结果,共有任务成功、等待、执行中和失败四种结果,具体信息请参见下文说明。
249
+ # <br>• 请求方法为 HTTP POST , Content-Type为"application/json; charset=utf-8"
250
+ # <br>• 签名方法参考 [公共参数](https://cloud.tencent.com/document/api/1093/35640) 中签名方法v3。
251
+ # <br>• 默认接口请求频率限制:50次/秒,如您有提高请求频率限制的需求,请提[工单](https://console.cloud.tencent.com/workorder/category)进行咨询。
252
+
253
+ # @param request: Request instance for DescribeTaskStatus.
254
+ # @type request: :class:`Tencentcloud::asr::V20190614::DescribeTaskStatusRequest`
255
+ # @rtype: :class:`Tencentcloud::asr::V20190614::DescribeTaskStatusResponse`
256
+ def DescribeTaskStatus(request)
257
+ body = send_request('DescribeTaskStatus', request.serialize)
258
+ response = JSON.parse(body)
259
+ if response['Response'].key?('Error') == false
260
+ model = DescribeTaskStatusResponse.new
261
+ model.deserialize(response['Response'])
262
+ model
263
+ else
264
+ code = response['Response']['Error']['Code']
265
+ message = response['Response']['Error']['Message']
266
+ reqid = response['Response']['RequestId']
267
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
268
+ end
269
+ rescue TencentCloud::Common::TencentCloudSDKException => e
270
+ raise e
271
+ rescue StandardError => e
272
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
273
+ end
274
+
275
+ # 用户通过本接口进行热词表的下载,获得词表权重文件形式的 base64 值,文件形式为通过 “|” 分割的词和权重,即 word|weight 的形式。
276
+
277
+ # @param request: Request instance for DownloadAsrVocab.
278
+ # @type request: :class:`Tencentcloud::asr::V20190614::DownloadAsrVocabRequest`
279
+ # @rtype: :class:`Tencentcloud::asr::V20190614::DownloadAsrVocabResponse`
280
+ def DownloadAsrVocab(request)
281
+ body = send_request('DownloadAsrVocab', request.serialize)
282
+ response = JSON.parse(body)
283
+ if response['Response'].key?('Error') == false
284
+ model = DownloadAsrVocabResponse.new
285
+ model.deserialize(response['Response'])
286
+ model
287
+ else
288
+ code = response['Response']['Error']['Code']
289
+ message = response['Response']['Error']['Message']
290
+ reqid = response['Response']['RequestId']
291
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
292
+ end
293
+ rescue TencentCloud::Common::TencentCloudSDKException => e
294
+ raise e
295
+ rescue StandardError => e
296
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
297
+ end
298
+
299
+ # 用户通过该接口可以下载自学习模型的语料
300
+
301
+ # @param request: Request instance for DownloadCustomization.
302
+ # @type request: :class:`Tencentcloud::asr::V20190614::DownloadCustomizationRequest`
303
+ # @rtype: :class:`Tencentcloud::asr::V20190614::DownloadCustomizationResponse`
304
+ def DownloadCustomization(request)
305
+ body = send_request('DownloadCustomization', request.serialize)
306
+ response = JSON.parse(body)
307
+ if response['Response'].key?('Error') == false
308
+ model = DownloadCustomizationResponse.new
309
+ model.deserialize(response['Response'])
310
+ model
311
+ else
312
+ code = response['Response']['Error']['Code']
313
+ message = response['Response']['Error']['Message']
314
+ reqid = response['Response']['RequestId']
315
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
316
+ end
317
+ rescue TencentCloud::Common::TencentCloudSDKException => e
318
+ raise e
319
+ rescue StandardError => e
320
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
321
+ end
322
+
323
+ # 用户根据词表的ID可以获取对应的热词表信息
324
+
325
+ # @param request: Request instance for GetAsrVocab.
326
+ # @type request: :class:`Tencentcloud::asr::V20190614::GetAsrVocabRequest`
327
+ # @rtype: :class:`Tencentcloud::asr::V20190614::GetAsrVocabResponse`
328
+ def GetAsrVocab(request)
329
+ body = send_request('GetAsrVocab', request.serialize)
330
+ response = JSON.parse(body)
331
+ if response['Response'].key?('Error') == false
332
+ model = GetAsrVocabResponse.new
333
+ model.deserialize(response['Response'])
334
+ model
335
+ else
336
+ code = response['Response']['Error']['Code']
337
+ message = response['Response']['Error']['Message']
338
+ reqid = response['Response']['RequestId']
339
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
340
+ end
341
+ rescue TencentCloud::Common::TencentCloudSDKException => e
342
+ raise e
343
+ rescue StandardError => e
344
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
345
+ end
346
+
347
+ # 用户通过该接口,可获得所有的热词表及其信息。
348
+
349
+ # @param request: Request instance for GetAsrVocabList.
350
+ # @type request: :class:`Tencentcloud::asr::V20190614::GetAsrVocabListRequest`
351
+ # @rtype: :class:`Tencentcloud::asr::V20190614::GetAsrVocabListResponse`
352
+ def GetAsrVocabList(request)
353
+ body = send_request('GetAsrVocabList', request.serialize)
354
+ response = JSON.parse(body)
355
+ if response['Response'].key?('Error') == false
356
+ model = GetAsrVocabListResponse.new
357
+ model.deserialize(response['Response'])
358
+ model
359
+ else
360
+ code = response['Response']['Error']['Code']
361
+ message = response['Response']['Error']['Message']
362
+ reqid = response['Response']['RequestId']
363
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
364
+ end
365
+ rescue TencentCloud::Common::TencentCloudSDKException => e
366
+ raise e
367
+ rescue StandardError => e
368
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
369
+ end
370
+
371
+ # 查询自学习模型列表
372
+
373
+ # @param request: Request instance for GetCustomizationList.
374
+ # @type request: :class:`Tencentcloud::asr::V20190614::GetCustomizationListRequest`
375
+ # @rtype: :class:`Tencentcloud::asr::V20190614::GetCustomizationListResponse`
376
+ def GetCustomizationList(request)
377
+ body = send_request('GetCustomizationList', request.serialize)
378
+ response = JSON.parse(body)
379
+ if response['Response'].key?('Error') == false
380
+ model = GetCustomizationListResponse.new
381
+ model.deserialize(response['Response'])
382
+ model
383
+ else
384
+ code = response['Response']['Error']['Code']
385
+ message = response['Response']['Error']['Message']
386
+ reqid = response['Response']['RequestId']
387
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
388
+ end
389
+ rescue TencentCloud::Common::TencentCloudSDKException => e
390
+ raise e
391
+ rescue StandardError => e
392
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
393
+ end
394
+
395
+ # 用户通过该接口可以更新自学习模型,如模型名称、模型类型、模型语料。
396
+
397
+ # @param request: Request instance for ModifyCustomization.
398
+ # @type request: :class:`Tencentcloud::asr::V20190614::ModifyCustomizationRequest`
399
+ # @rtype: :class:`Tencentcloud::asr::V20190614::ModifyCustomizationResponse`
400
+ def ModifyCustomization(request)
401
+ body = send_request('ModifyCustomization', request.serialize)
402
+ response = JSON.parse(body)
403
+ if response['Response'].key?('Error') == false
404
+ model = ModifyCustomizationResponse.new
405
+ model.deserialize(response['Response'])
406
+ model
407
+ else
408
+ code = response['Response']['Error']['Code']
409
+ message = response['Response']['Error']['Message']
410
+ reqid = response['Response']['RequestId']
411
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
412
+ end
413
+ rescue TencentCloud::Common::TencentCloudSDKException => e
414
+ raise e
415
+ rescue StandardError => e
416
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
417
+ end
418
+
419
+ # 通过该接口,用户可以修改自学习模型状态,上下线自学习模型
420
+
421
+ # @param request: Request instance for ModifyCustomizationState.
422
+ # @type request: :class:`Tencentcloud::asr::V20190614::ModifyCustomizationStateRequest`
423
+ # @rtype: :class:`Tencentcloud::asr::V20190614::ModifyCustomizationStateResponse`
424
+ def ModifyCustomizationState(request)
425
+ body = send_request('ModifyCustomizationState', request.serialize)
426
+ response = JSON.parse(body)
427
+ if response['Response'].key?('Error') == false
428
+ model = ModifyCustomizationStateResponse.new
429
+ model.deserialize(response['Response'])
430
+ model
431
+ else
432
+ code = response['Response']['Error']['Code']
433
+ message = response['Response']['Error']['Message']
434
+ reqid = response['Response']['RequestId']
435
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
436
+ end
437
+ rescue TencentCloud::Common::TencentCloudSDKException => e
438
+ raise e
439
+ rescue StandardError => e
440
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
441
+ end
442
+
443
+ # 本接口用于对60秒之内的短音频文件进行识别。<br>• 支持中文普通话、英语、粤语、日语、上海话方言。<br>• 支持本地语音文件上传和语音URL上传两种请求方式,音频时长不能超过60s,音频文件大小不能超过3MB。<br>• 音频格式支持wav、mp3;采样率支持8000Hz或者16000Hz;采样精度支持16bits;声道支持单声道。<br>• 请求方法为 HTTP POST , Content-Type为"application/json; charset=utf-8"<br>• 签名方法参考 [公共参数](https://cloud.tencent.com/document/api/1093/35640) 中签名方法v3。<br>• 默认接口请求频率限制:25次/秒,如您有提高请求频率限制的需求,请提[工单](https://console.cloud.tencent.com/workorder/category)进行咨询。
444
+
445
+ # @param request: Request instance for SentenceRecognition.
446
+ # @type request: :class:`Tencentcloud::asr::V20190614::SentenceRecognitionRequest`
447
+ # @rtype: :class:`Tencentcloud::asr::V20190614::SentenceRecognitionResponse`
448
+ def SentenceRecognition(request)
449
+ body = send_request('SentenceRecognition', request.serialize)
450
+ response = JSON.parse(body)
451
+ if response['Response'].key?('Error') == false
452
+ model = SentenceRecognitionResponse.new
453
+ model.deserialize(response['Response'])
454
+ model
455
+ else
456
+ code = response['Response']['Error']['Code']
457
+ message = response['Response']['Error']['Message']
458
+ reqid = response['Response']['RequestId']
459
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
460
+ end
461
+ rescue TencentCloud::Common::TencentCloudSDKException => e
462
+ raise e
463
+ rescue StandardError => e
464
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
465
+ end
466
+
467
+ # 用户通过该接口可以设置热词表的默认状态。初始状态为0,用户可设置状态为1,即为默认状态。默认状态表示用户在请求识别时,如不设置热词表ID,则默认使用状态为1的热词表。
468
+
469
+ # @param request: Request instance for SetVocabState.
470
+ # @type request: :class:`Tencentcloud::asr::V20190614::SetVocabStateRequest`
471
+ # @rtype: :class:`Tencentcloud::asr::V20190614::SetVocabStateResponse`
472
+ def SetVocabState(request)
473
+ body = send_request('SetVocabState', request.serialize)
474
+ response = JSON.parse(body)
475
+ if response['Response'].key?('Error') == false
476
+ model = SetVocabStateResponse.new
477
+ model.deserialize(response['Response'])
478
+ model
479
+ else
480
+ code = response['Response']['Error']['Code']
481
+ message = response['Response']['Error']['Message']
482
+ reqid = response['Response']['RequestId']
483
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
484
+ end
485
+ rescue TencentCloud::Common::TencentCloudSDKException => e
486
+ raise e
487
+ rescue StandardError => e
488
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
489
+ end
490
+
491
+ # 用户通过本接口进行对应的词表信息更新。
492
+
493
+ # @param request: Request instance for UpdateAsrVocab.
494
+ # @type request: :class:`Tencentcloud::asr::V20190614::UpdateAsrVocabRequest`
495
+ # @rtype: :class:`Tencentcloud::asr::V20190614::UpdateAsrVocabResponse`
496
+ def UpdateAsrVocab(request)
497
+ body = send_request('UpdateAsrVocab', request.serialize)
498
+ response = JSON.parse(body)
499
+ if response['Response'].key?('Error') == false
500
+ model = UpdateAsrVocabResponse.new
501
+ model.deserialize(response['Response'])
502
+ model
503
+ else
504
+ code = response['Response']['Error']['Code']
505
+ message = response['Response']['Error']['Message']
506
+ reqid = response['Response']['RequestId']
507
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
508
+ end
509
+ rescue TencentCloud::Common::TencentCloudSDKException => e
510
+ raise e
511
+ rescue StandardError => e
512
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
513
+ end
514
+
515
+
516
+ end
517
+ end
518
+ end
519
+ end