lib/v20190408/client.rb in tencentcloud-sdk-nlp-1.0.275 vs lib/v20190408/client.rb in tencentcloud-sdk-nlp-1.0.276
- old
+ new
@@ -582,9 +582,37 @@
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
+ # 句子相似度接口能够基于深度学习技术来计算一个源句子和多个目标句子的相似度,相似度分值越大的两个句子在语义上越相似。目前仅支持短文本(不超过128字符)的相似度计算,长文本的相似度计算也即将推出。
+
+ # 鉴于句子相似度是一个应用非常广泛的功能,腾讯云自然语言处理团队在Bert等领先的深度神经网络模型的基础上,专门针对文本相似任务进行了优化,并持续迭代更新。基于句子相似度,可以轻松实现诸如文本去重、相似推荐等功能。
+
+ # 接口将以句子数量为单位消耗资源包,而不是调用接口次数为单位。
+
+ # @param request: Request instance for TextSimilarityPro.
+ # @type request: :class:`Tencentcloud::nlp::V20190408::TextSimilarityProRequest`
+ # @rtype: :class:`Tencentcloud::nlp::V20190408::TextSimilarityProResponse`
+ def TextSimilarityPro(request)
+ body = send_request('TextSimilarityPro', request.serialize)
+ response = JSON.parse(body)
+ if response['Response'].key?('Error') == false
+ model = TextSimilarityProResponse.new
+ model.deserialize(response['Response'])
+ model
+ else
+ code = response['Response']['Error']['Code']
+ message = response['Response']['Error']['Message']
+ reqid = response['Response']['RequestId']
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
+ end
+ rescue TencentCloud::Common::TencentCloudSDKException => e
+ raise e
+ rescue StandardError => e
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
+ end
+
# 修改自定义词库元数据信息,包括名称、描述。
# @param request: Request instance for UpdateDict.
# @type request: :class:`Tencentcloud::nlp::V20190408::UpdateDictRequest`
# @rtype: :class:`Tencentcloud::nlp::V20190408::UpdateDictResponse`
\ No newline at end of file