tencentcloud-sdk-nlp 1.0.275 → 1.0.276
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/VERSION +1 -1
- data/lib/v20190408/client.rb +28 -0
- data/lib/v20190408/models.rb +47 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1e92fd6fcfbd58250c69004d397d6c1d021804e
|
4
|
+
data.tar.gz: ca1ead4534345da08322c7926fa83b31efcb79a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 572666e284d5d72f1b55e9d6696ec402a340d3012a4bbb1a2582a02f79aaaf29be3bf86e5274f1e4882004a757cdb801167ac8f346b7ccdec6d575f56dfb2b74
|
7
|
+
data.tar.gz: 071bdceaa4d0c119727c62801e51aac4464f1e4a2263bfa13adf63fcd674c6a5cd7ea8385f19434843451f59ec057e31d43c11d317ab196a9442e08da0231a69
|
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.276
|
data/lib/v20190408/client.rb
CHANGED
@@ -584,6 +584,34 @@ module TencentCloud
|
|
584
584
|
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
|
585
585
|
end
|
586
586
|
|
587
|
+
# 句子相似度接口能够基于深度学习技术来计算一个源句子和多个目标句子的相似度,相似度分值越大的两个句子在语义上越相似。目前仅支持短文本(不超过128字符)的相似度计算,长文本的相似度计算也即将推出。
|
588
|
+
|
589
|
+
# 鉴于句子相似度是一个应用非常广泛的功能,腾讯云自然语言处理团队在Bert等领先的深度神经网络模型的基础上,专门针对文本相似任务进行了优化,并持续迭代更新。基于句子相似度,可以轻松实现诸如文本去重、相似推荐等功能。
|
590
|
+
|
591
|
+
# 接口将以句子数量为单位消耗资源包,而不是调用接口次数为单位。
|
592
|
+
|
593
|
+
# @param request: Request instance for TextSimilarityPro.
|
594
|
+
# @type request: :class:`Tencentcloud::nlp::V20190408::TextSimilarityProRequest`
|
595
|
+
# @rtype: :class:`Tencentcloud::nlp::V20190408::TextSimilarityProResponse`
|
596
|
+
def TextSimilarityPro(request)
|
597
|
+
body = send_request('TextSimilarityPro', request.serialize)
|
598
|
+
response = JSON.parse(body)
|
599
|
+
if response['Response'].key?('Error') == false
|
600
|
+
model = TextSimilarityProResponse.new
|
601
|
+
model.deserialize(response['Response'])
|
602
|
+
model
|
603
|
+
else
|
604
|
+
code = response['Response']['Error']['Code']
|
605
|
+
message = response['Response']['Error']['Message']
|
606
|
+
reqid = response['Response']['RequestId']
|
607
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
|
608
|
+
end
|
609
|
+
rescue TencentCloud::Common::TencentCloudSDKException => e
|
610
|
+
raise e
|
611
|
+
rescue StandardError => e
|
612
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
|
613
|
+
end
|
614
|
+
|
587
615
|
# 修改自定义词库元数据信息,包括名称、描述。
|
588
616
|
|
589
617
|
# @param request: Request instance for UpdateDict.
|
data/lib/v20190408/models.rb
CHANGED
@@ -1393,6 +1393,53 @@ module TencentCloud
|
|
1393
1393
|
end
|
1394
1394
|
end
|
1395
1395
|
|
1396
|
+
# TextSimilarityPro请求参数结构体
|
1397
|
+
class TextSimilarityProRequest < TencentCloud::Common::AbstractModel
|
1398
|
+
# @param SrcText: 需要与目标句子计算相似度的源句子(仅支持UTF-8格式,不超过128字符)
|
1399
|
+
# @type SrcText: String
|
1400
|
+
# @param TargetText: 目标句子(仅支持UTF-8格式,不超过128字符)
|
1401
|
+
# @type TargetText: Array
|
1402
|
+
|
1403
|
+
attr_accessor :SrcText, :TargetText
|
1404
|
+
|
1405
|
+
def initialize(srctext=nil, targettext=nil)
|
1406
|
+
@SrcText = srctext
|
1407
|
+
@TargetText = targettext
|
1408
|
+
end
|
1409
|
+
|
1410
|
+
def deserialize(params)
|
1411
|
+
@SrcText = params['SrcText']
|
1412
|
+
@TargetText = params['TargetText']
|
1413
|
+
end
|
1414
|
+
end
|
1415
|
+
|
1416
|
+
# TextSimilarityPro返回参数结构体
|
1417
|
+
class TextSimilarityProResponse < TencentCloud::Common::AbstractModel
|
1418
|
+
# @param Similarity: 每个目标句子与源句子的相似度分值,按照分值降序排列
|
1419
|
+
# @type Similarity: Array
|
1420
|
+
# @param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
|
1421
|
+
# @type RequestId: String
|
1422
|
+
|
1423
|
+
attr_accessor :Similarity, :RequestId
|
1424
|
+
|
1425
|
+
def initialize(similarity=nil, requestid=nil)
|
1426
|
+
@Similarity = similarity
|
1427
|
+
@RequestId = requestid
|
1428
|
+
end
|
1429
|
+
|
1430
|
+
def deserialize(params)
|
1431
|
+
unless params['Similarity'].nil?
|
1432
|
+
@Similarity = []
|
1433
|
+
params['Similarity'].each do |i|
|
1434
|
+
similarity_tmp = Similarity.new
|
1435
|
+
similarity_tmp.deserialize(i)
|
1436
|
+
@Similarity << similarity_tmp
|
1437
|
+
end
|
1438
|
+
end
|
1439
|
+
@RequestId = params['RequestId']
|
1440
|
+
end
|
1441
|
+
end
|
1442
|
+
|
1396
1443
|
# TextSimilarity请求参数结构体
|
1397
1444
|
class TextSimilarityRequest < TencentCloud::Common::AbstractModel
|
1398
1445
|
# @param SrcText: 需要与目标句子计算相似度的源句子(仅支持UTF-8格式,不超过500字符)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tencentcloud-sdk-nlp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.276
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tencent Cloud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tencentcloud-sdk-common
|