tencentcloud-sdk-tsi 3.0.850

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: b90075bb5904f02bea3f1e30246f62a02e0ba177
4
+ data.tar.gz: 1193d17b327e5912837585207dd708cb57d36edf
5
+ SHA512:
6
+ metadata.gz: 3d48a1191959d00a1ba7c98cb00f88df82fa91faf223544d36f433b34d9827b067b717ee29ce19154e36e3beb091f45cfcb6231acdba9c125b510ac10a695a1c
7
+ data.tar.gz: 17063309f354c953e2a9ab2e6a727adf290e7da4b4ccb896051bdd3596bec3a7fcdf8b566fdb8c611b1baa2829a03543150df11517d79b77cf131463defc964d
data/lib/VERSION ADDED
@@ -0,0 +1 @@
1
+ 3.0.850
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tencentcloud-sdk-common'
4
+
5
+ require_relative 'v20210325/client'
6
+ require_relative 'v20210325/models'
7
+
8
+ module TencentCloud
9
+ module Tsi
10
+ end
11
+ end
@@ -0,0 +1,108 @@
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 Tsi
21
+ module V20210325
22
+ class Client < TencentCloud::Common::AbstractClient
23
+
24
+ def initialize(credential, region, profile = nil)
25
+ api_version = '2021-03-25'
26
+ api_endpoint = 'tsi.tencentcloudapi.com'
27
+ sdk_version = 'TSI_' + 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 TongChuanDisplay.
35
+ # @type request: :class:`Tencentcloud::tsi::V20210325::TongChuanDisplayRequest`
36
+ # @rtype: :class:`Tencentcloud::tsi::V20210325::TongChuanDisplayResponse`
37
+ def TongChuanDisplay(request)
38
+ body = send_request('TongChuanDisplay', request.serialize)
39
+ response = JSON.parse(body)
40
+ if response['Response'].key?('Error') == false
41
+ model = TongChuanDisplayResponse.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
+ # 本接口提供上传音频,将音频进行语音识别并翻译成文本的服务,目前开放中英互译的同传服务。 待识别和翻译的音频文件格式是 pcm,pcm采样率要求16kHz、位深16bit、单声道、每个分片时长200ms~500ms,音频内语音清晰。
57
+
58
+ # @param request: Request instance for TongChuanRecognize.
59
+ # @type request: :class:`Tencentcloud::tsi::V20210325::TongChuanRecognizeRequest`
60
+ # @rtype: :class:`Tencentcloud::tsi::V20210325::TongChuanRecognizeResponse`
61
+ def TongChuanRecognize(request)
62
+ body = send_request('TongChuanRecognize', request.serialize)
63
+ response = JSON.parse(body)
64
+ if response['Response'].key?('Error') == false
65
+ model = TongChuanRecognizeResponse.new
66
+ model.deserialize(response['Response'])
67
+ model
68
+ else
69
+ code = response['Response']['Error']['Code']
70
+ message = response['Response']['Error']['Message']
71
+ reqid = response['Response']['RequestId']
72
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
73
+ end
74
+ rescue TencentCloud::Common::TencentCloudSDKException => e
75
+ raise e
76
+ rescue StandardError => e
77
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
78
+ end
79
+
80
+ # 本接口提供上传音频,将音频进行语音识别并翻译成文本的服务,目前开放中英互译的同传服务。 待识别和翻译的音频文件格式是 pcm,pcm采样率要求16kHz、位深16bit、单声道、每个分片时长200ms~500ms,音频内语音清晰。
81
+
82
+ # @param request: Request instance for TongChuanSync.
83
+ # @type request: :class:`Tencentcloud::tsi::V20210325::TongChuanSyncRequest`
84
+ # @rtype: :class:`Tencentcloud::tsi::V20210325::TongChuanSyncResponse`
85
+ def TongChuanSync(request)
86
+ body = send_request('TongChuanSync', request.serialize)
87
+ response = JSON.parse(body)
88
+ if response['Response'].key?('Error') == false
89
+ model = TongChuanSyncResponse.new
90
+ model.deserialize(response['Response'])
91
+ model
92
+ else
93
+ code = response['Response']['Error']['Code']
94
+ message = response['Response']['Error']['Message']
95
+ reqid = response['Response']['RequestId']
96
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
97
+ end
98
+ rescue TencentCloud::Common::TencentCloudSDKException => e
99
+ raise e
100
+ rescue StandardError => e
101
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
102
+ end
103
+
104
+
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,253 @@
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
+ module TencentCloud
18
+ module Tsi
19
+ module V20210325
20
+ # 同传结果数据
21
+ class DisplayInfo < TencentCloud::Common::AbstractModel
22
+ # @param SeId: 句子 ID
23
+ # @type SeId: String
24
+ # @param SeVer: 句子版本号
25
+ # @type SeVer: Integer
26
+ # @param SourceText: 识别结果
27
+ # @type SourceText: String
28
+ # @param TargetText: 翻译结果
29
+ # @type TargetText: String
30
+ # @param StartTime: 句子开始时间
31
+ # @type StartTime: Integer
32
+ # @param EndTime: 句子结束时间
33
+ # @type EndTime: Integer
34
+ # @param IsEnd: 当前句子是否已结束
35
+ # @type IsEnd: Boolean
36
+
37
+ attr_accessor :SeId, :SeVer, :SourceText, :TargetText, :StartTime, :EndTime, :IsEnd
38
+
39
+ def initialize(seid=nil, sever=nil, sourcetext=nil, targettext=nil, starttime=nil, endtime=nil, isend=nil)
40
+ @SeId = seid
41
+ @SeVer = sever
42
+ @SourceText = sourcetext
43
+ @TargetText = targettext
44
+ @StartTime = starttime
45
+ @EndTime = endtime
46
+ @IsEnd = isend
47
+ end
48
+
49
+ def deserialize(params)
50
+ @SeId = params['SeId']
51
+ @SeVer = params['SeVer']
52
+ @SourceText = params['SourceText']
53
+ @TargetText = params['TargetText']
54
+ @StartTime = params['StartTime']
55
+ @EndTime = params['EndTime']
56
+ @IsEnd = params['IsEnd']
57
+ end
58
+ end
59
+
60
+ # TongChuanDisplay请求参数结构体
61
+ class TongChuanDisplayRequest < TencentCloud::Common::AbstractModel
62
+ # @param SessionUuid: 一段完整的语音对应一个SessionUuid
63
+ # @type SessionUuid: String
64
+ # @param IsNew: 句子排序方式,1-由新到旧
65
+ # @type IsNew: Integer
66
+ # @param SeMax: 最多返回几句,目前只支持 5 条数据
67
+ # @type SeMax: Integer
68
+
69
+ attr_accessor :SessionUuid, :IsNew, :SeMax
70
+
71
+ def initialize(sessionuuid=nil, isnew=nil, semax=nil)
72
+ @SessionUuid = sessionuuid
73
+ @IsNew = isnew
74
+ @SeMax = semax
75
+ end
76
+
77
+ def deserialize(params)
78
+ @SessionUuid = params['SessionUuid']
79
+ @IsNew = params['IsNew']
80
+ @SeMax = params['SeMax']
81
+ end
82
+ end
83
+
84
+ # TongChuanDisplay返回参数结构体
85
+ class TongChuanDisplayResponse < TencentCloud::Common::AbstractModel
86
+ # @param List: 同传结果数组
87
+ # @type List: Array
88
+ # @param RequestId: 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
89
+ # @type RequestId: String
90
+
91
+ attr_accessor :List, :RequestId
92
+
93
+ def initialize(list=nil, requestid=nil)
94
+ @List = list
95
+ @RequestId = requestid
96
+ end
97
+
98
+ def deserialize(params)
99
+ unless params['List'].nil?
100
+ @List = []
101
+ params['List'].each do |i|
102
+ displayinfo_tmp = DisplayInfo.new
103
+ displayinfo_tmp.deserialize(i)
104
+ @List << displayinfo_tmp
105
+ end
106
+ end
107
+ @RequestId = params['RequestId']
108
+ end
109
+ end
110
+
111
+ # TongChuanRecognize请求参数结构体
112
+ class TongChuanRecognizeRequest < TencentCloud::Common::AbstractModel
113
+ # @param SessionUuid: 一段完整的语音对应一个SessionUuid
114
+ # @type SessionUuid: String
115
+ # @param Source: 音频中的语言类型,支持语言列表<li> zh : 中文 </li> <li> en : 英文 </li>
116
+ # @type Source: String
117
+ # @param Target: 翻译目标语言类型,支持的语言列表<li> zh : 中文 </li> <li> en : 英文 </li>
118
+ # @type Target: String
119
+ # @param AudioFormat: 语音编码类型,1-pcm
120
+ # @type AudioFormat: Integer
121
+ # @param Seq: 语音分片的序号,从0开始
122
+ # @type Seq: Integer
123
+ # @param Utc: 语音开始的时间戳
124
+ # @type Utc: Integer
125
+ # @param IsEnd: 是否最后一片语音分片,0-否,1-是
126
+ # @type IsEnd: Integer
127
+ # @param TranslateTime: 翻译时机,0 -不翻译 1 - 句子结束时翻译,2 - 句子实时翻译
128
+ # @type TranslateTime: Integer
129
+ # @param Data: 语音分片内容进行 Base64 编码后的字符串。音频内容需包含有效并可识别的文本信息。
130
+ # @type Data: String
131
+
132
+ attr_accessor :SessionUuid, :Source, :Target, :AudioFormat, :Seq, :Utc, :IsEnd, :TranslateTime, :Data
133
+
134
+ def initialize(sessionuuid=nil, source=nil, target=nil, audioformat=nil, seq=nil, utc=nil, isend=nil, translatetime=nil, data=nil)
135
+ @SessionUuid = sessionuuid
136
+ @Source = source
137
+ @Target = target
138
+ @AudioFormat = audioformat
139
+ @Seq = seq
140
+ @Utc = utc
141
+ @IsEnd = isend
142
+ @TranslateTime = translatetime
143
+ @Data = data
144
+ end
145
+
146
+ def deserialize(params)
147
+ @SessionUuid = params['SessionUuid']
148
+ @Source = params['Source']
149
+ @Target = params['Target']
150
+ @AudioFormat = params['AudioFormat']
151
+ @Seq = params['Seq']
152
+ @Utc = params['Utc']
153
+ @IsEnd = params['IsEnd']
154
+ @TranslateTime = params['TranslateTime']
155
+ @Data = params['Data']
156
+ end
157
+ end
158
+
159
+ # TongChuanRecognize返回参数结构体
160
+ class TongChuanRecognizeResponse < TencentCloud::Common::AbstractModel
161
+ # @param RequestId: 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
162
+ # @type RequestId: String
163
+
164
+ attr_accessor :RequestId
165
+
166
+ def initialize(requestid=nil)
167
+ @RequestId = requestid
168
+ end
169
+
170
+ def deserialize(params)
171
+ @RequestId = params['RequestId']
172
+ end
173
+ end
174
+
175
+ # TongChuanSync请求参数结构体
176
+ class TongChuanSyncRequest < TencentCloud::Common::AbstractModel
177
+ # @param SessionUuid: 一段完整的语音对应一个SessionUuid
178
+ # @type SessionUuid: String
179
+ # @param Source: 音频中的语言类型,支持语言列表<li> zh : 中文 </li> <li> en : 英文 </li>
180
+ # @type Source: String
181
+ # @param Target: 翻译目标语言类型,支持的语言列表<li> zh : 中文 </li> <li> en : 英文 </li>
182
+ # @type Target: String
183
+ # @param AudioFormat: 语音编码类型,1-pcm
184
+ # @type AudioFormat: Integer
185
+ # @param Seq: 语音分片的序号,从0开始
186
+ # @type Seq: Integer
187
+ # @param Utc: 语音开始的时间戳
188
+ # @type Utc: Integer
189
+ # @param IsEnd: 是否最后一片语音分片,0-否,1-是
190
+ # @type IsEnd: Integer
191
+ # @param TranslateTime: 翻译时机,0 -不翻译 1 - 句子结束时翻译,2 - 句子实时翻译
192
+ # @type TranslateTime: Integer
193
+ # @param Data: 语音分片内容进行 Base64 编码后的字符串。音频内容需包含有效并可识别的文本信息。
194
+ # @type Data: String
195
+
196
+ attr_accessor :SessionUuid, :Source, :Target, :AudioFormat, :Seq, :Utc, :IsEnd, :TranslateTime, :Data
197
+
198
+ def initialize(sessionuuid=nil, source=nil, target=nil, audioformat=nil, seq=nil, utc=nil, isend=nil, translatetime=nil, data=nil)
199
+ @SessionUuid = sessionuuid
200
+ @Source = source
201
+ @Target = target
202
+ @AudioFormat = audioformat
203
+ @Seq = seq
204
+ @Utc = utc
205
+ @IsEnd = isend
206
+ @TranslateTime = translatetime
207
+ @Data = data
208
+ end
209
+
210
+ def deserialize(params)
211
+ @SessionUuid = params['SessionUuid']
212
+ @Source = params['Source']
213
+ @Target = params['Target']
214
+ @AudioFormat = params['AudioFormat']
215
+ @Seq = params['Seq']
216
+ @Utc = params['Utc']
217
+ @IsEnd = params['IsEnd']
218
+ @TranslateTime = params['TranslateTime']
219
+ @Data = params['Data']
220
+ end
221
+ end
222
+
223
+ # TongChuanSync返回参数结构体
224
+ class TongChuanSyncResponse < TencentCloud::Common::AbstractModel
225
+ # @param List: 同传结果数组
226
+ # @type List: Array
227
+ # @param RequestId: 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
228
+ # @type RequestId: String
229
+
230
+ attr_accessor :List, :RequestId
231
+
232
+ def initialize(list=nil, requestid=nil)
233
+ @List = list
234
+ @RequestId = requestid
235
+ end
236
+
237
+ def deserialize(params)
238
+ unless params['List'].nil?
239
+ @List = []
240
+ params['List'].each do |i|
241
+ displayinfo_tmp = DisplayInfo.new
242
+ displayinfo_tmp.deserialize(i)
243
+ @List << displayinfo_tmp
244
+ end
245
+ end
246
+ @RequestId = params['RequestId']
247
+ end
248
+ end
249
+
250
+ end
251
+ end
252
+ end
253
+
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tencentcloud-sdk-tsi
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.850
5
+ platform: ruby
6
+ authors:
7
+ - Tencent Cloud
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-06-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tencentcloud-sdk-common
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ description: Tencent Cloud Ruby SDK is the official software development kit, which
28
+ allows Ruby developers to write software that makes use of Tencent Cloud service
29
+ TSI.
30
+ email:
31
+ - tencentcloudapi@tencent.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - lib/v20210325/models.rb
37
+ - lib/v20210325/client.rb
38
+ - lib/tencentcloud-sdk-tsi.rb
39
+ - lib/VERSION
40
+ homepage: https://github.com/TencentCloud/tencentcloud-sdk-ruby
41
+ licenses:
42
+ - Apache-2.0
43
+ metadata:
44
+ source_code_uri: https://github.com/TencentCloud/tencentcloud-sdk-ruby/tencentcloud-sdk-tsi
45
+ changelog_uri: https://github.com/TencentCloud/tencentcloud-sdk-ruby/blob/master/CHANGELOG.md
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.0.14
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Tencent Cloud SDK for Ruby - TSI
66
+ test_files: []