简介
本文档提供关于词性分析的相关 API 概览以及 SDK 示例代码。
API | 操作描述 |
提交一个分词任务。 |
SDK API 参考
提交任务
功能说明
提交一个分词任务。
说明:
COS iOS SDK 版本需要大于等于 v6.2.9。
示例代码
Objective-C
QCloudPostWordsGeneralizeRequest * request = [QCloudPostWordsGeneralizeRequest new];request.bucket = @"sample-1250000000";request.regionName = @"COS_REGIONNAME";request.input = [QCloudPostWordsGeneralize new];// 创建任务的 Tag:WordsGeneralize;是否必传:是request.input.Tag = @"";// 待操作的对象信息;是否必传:是request.input.Input = [QCloudPostWordsGeneralizeInput new];// 文件路径;是否必传:是request.input.Input.Object = @"";// 操作规则;是否必传:是request.input.Operation = [QCloudPostWordsGeneralizeOperation new];// 指定分词参数;是否必传:是request.input.Operation.WordsGeneralize = [QCloudPostWordsGeneralizeWordsGeneralize new];// 任务回调 TDMQ 配置,当 CallBackType 为 TDMQ 时必填。详情见 CallBackMqConfig;是否必传:否request.input.CallBackMqConfig = [QCloudCallBackMqConfig new];// 消息队列所属园区,目前支持园区 sh(上海)、bj(北京)、gz(广州)、cd(成都)、hk(中国香港);是否必传:是request.input.CallBackMqConfig.MqRegion = @"";// 消息队列使用模式,默认 Queue :主题订阅:Topic队列服务: Queue;是否必传:是request.input.CallBackMqConfig.MqMode = @"";// TDMQ 主题名称;是否必传:是request.input.CallBackMqConfig.MqName = @"";[request setFinishBlock:^(QCloudPostWordsGeneralizeResponse * outputObject, NSError *error) {// result:QCloudPostWordsGeneralizeResponse 包含所有的响应;// 具体查看代码注释或api文档:https://cloud.tencent.com/document/product/460/84800// outputObject返回JobId,使用QCloudGetMediaJobRequest 查询结果}];[[QCloudCOSXMLService defaultCOSXML] PostWordsGeneralize:request];
注意:
Swift
let request : QCloudPostWordsGeneralizeRequest = QCloudPostWordsGeneralizeRequest();request.bucket = "sample-1250000000";request.regionName = "COS_REGIONNAME";let postWordsGeneralize : QCloudPostWordsGeneralize = QCloudPostWordsGeneralize();// 创建任务的 Tag:WordsGeneralize;是否必传:是request.input = postWordsGeneralize;request.input.tag = "";// 待操作的对象信息;是否必传:是let input : QCloudPostWordsGeneralizeInput = QCloudPostWordsGeneralizeInput();request.input.input = input;// 文件路径;是否必传:是request.input.input.object = "";// 操作规则;是否必传:是let operation : QCloudPostWordsGeneralizeOperation = QCloudPostWordsGeneralizeOperation();request.input.operation = operation;// 指定分词参数;是否必传:是let wordsGeneralize : QCloudPostWordsGeneralizeWordsGeneralize = QCloudPostWordsGeneralizeWordsGeneralize();request.input.operation.wordsGeneralize = wordsGeneralize;request.finishBlock = { result, error in// result:QCloudPostWordsGeneralizeResponse 包含所有的响应;// 具体查看代码注释或api文档:https://cloud.tencent.com/document/product/460/84800};QCloudCOSXMLService.defaultCOSXML().postWordsGeneralize(request);
注意: