tencent cloud

文档反馈

提交分词任务

最后更新时间:2023-12-30 16:46:10

    功能描述

    提交一个分词任务。
    

    请求

    请求示例

    POST /ai_jobs HTTP/1.1
    Host: <BucketName-APPID>.ci.<Region>.myqcloud.com
    Date: <GMT Date>
    Authorization: <Auth String>
    Content-Length: <length>
    Content-Type: application/xml
    
    <body>
    说明
    Authorization: Auth String(详情请参见 请求签名 文档)。
    通过子账号使用时,需要授予相关的权限,详情请参见 授权粒度详情 文档。

    请求头

    此接口仅使用公共请求头部,详情请参见 公共请求头部 文档。

    请求体

    该请求操作的实现需要有如下请求体。
    <Request>
    <Tag>WordsGeneralize</Tag>
    <Input>
    <Object>text.txt</Object>
    </Input>
    <Operation>
    <WordsGeneralize>
    <NerMethod>DL</NerMethod>
    <SegMethod>Mix</SegMethod>
    </WordsGeneralize>
    <UserData>This is my data.</UserData>
    <JobLevel>0</JobLevel>
    </Operation>
    <QueueId>pcd463e1467964d39ad2d3f66aacd8199</QueueId>
    <CallBack>http://callback.demo.com</CallBack>
    <CallBackFormat>JSON<CallBackFormat>
    </Request>
    具体的数据描述如下:
    节点名称(关键字)
    父节点
    描述
    类型
    是否必选
    Request
    保存请求的容器
    Container
    Container 类型 Request 的具体数据描述如下:
    节点名称(关键字)
    父节点
    描述
    类型
    是否必选
    Tag
    Request
    创建任务的 Tag:WordsGeneralize
    String
    Input
    Request
    待操作的对象信息
    Container
    Operation
    Request
    操作规则
    Container
    QueueId
    Request
    任务所在的队列 ID
    String
    CallBack
    Request
    任务回调地址,优先级高于队列的回调地址。设置为 no 时,表示队列的回调地址不产生回调
    String
    CallBackFormat
    Request
    任务回调格式,JSON 或 XML,默认 XML,优先级高于队列的回调格式
    String
    Container 类型 Input 的具体数据描述如下:
    节点名称(关键字)
    父节点
    描述
    类型
    是否必选
    Object
    Request.Input
    媒体文件名
    String
    Container 类型 Operation 的具体数据描述如下:
    节点名称(关键字)
    父节点
    描述
    类型
    是否必选
    WordsGeneralize
    Request.Operation
    指定分词参数
    Container
    UserData
    Request.Operation
    透传用户信息,可打印的 ASCII 码,长度不超过1024
    String
    JobLevel
    Request.Operation
    任务优先级,级别限制:0 、1 、2 。级别越大任务优先级越高,默认为0
    String
    Container 类型 WordsGeneralize 的具体数据描述如下:
    节点名称(关键字)
    父节点
    描述
    类型
    是否必选
    限制
    NerMethod
    Request.Operation.WordsGeneralize
    ner 方式,默认值 DL
    String
    NerBasic 或 DL
    SegMethod
    Request.Operation.WordsGeneralize
    分词粒度,默认值 MIX
    String
    SegBasic 或 MIX

    响应

    响应头

    此接口仅返回公共响应头部,详情请参见 公共响应头部 文档。

    响应体

    该响应体返回为 application/xml 数据,包含完整节点数据的内容展示如下:
    <Response>
    <JobsDetail>
    <Code>Success</Code>
    <Message/>
    <JobId>ac7c990a00bf211ed946af9e0691f2b7a</JobId>
    <State>Submitted</State>
    <CreationTime>2022-06-27T14:44:10+0800</CreationTime>
    <StartTime>-</StartTime>
    <EndTime>-</EndTime>
    <QueueId>pcd463e1467964d39ad2d3f66aacd8199</QueueId>
    <Tag>WordsGeneralize</Tag>
    <Input>
    <Object>text.txt</Object>
    </Input>
    <Operation>
    <WordsGeneralize>
    <NerMethod>DL</NerMethod>
    <SegMethod>Mix</SegMethod>
    </WordsGeneralize>
    <UserData>This is my data.</UserData>
    <JobLevel>0</JobLevel>
    </Operation>
    </JobsDetail>
    </Response>
    具体的数据内容如下:
    节点名称(关键字)
    父节点
    描述
    类型
    Response
    保存结果的容器
    Container
    Container 节点 Response 的内容:
    节点名称(关键字)
    父节点
    描述
    类型
    JobsDetail
    Response
    任务的详细信息
    Container
    Container 节点 JobsDetail 的内容:
    节点名称(关键字)
    父节点
    描述
    类型
    Code
    Response.JobsDetail
    错误码,只有 State 为 Failed 时有意义
    String
    Message
    Response.JobsDetail
    错误描述,只有 State 为 Failed 时有意义
    String
    JobId
    Response.JobsDetail
    新创建任务的 ID
    String
    Tag
    Response.JobsDetail
    新创建任务的 Tag:WordsGeneralize
    String
    State
    Response.JobsDetail
    任务的状态,为 Submitted、Running、Success、Failed、Pause、Cancel 其中一个
    String
    CreationTime
    Response.JobsDetail
    任务的创建时间
    String
    StartTime
    Response.JobsDetail
    任务的开始时间
    String
    EndTime
    Response.JobsDetail
    任务的结束时间
    String
    QueueId
    Response.JobsDetail
    任务所属的队列 ID
    String
    Input
    Response.JobsDetail
    同请求中的 Request.Input 节点
    Container
    Operation
    Response.JobsDetail
    该任务的规则
    Container
    Container 节点 Operation 的内容:
    节点名称(关键字)
    父节点
    描述
    类型
    WordsGeneralize
    Response.JobsDetail.Operation
    同请求中的 Request.Operation.WordsGeneralize
    Container
    UserData
    Response.JobsDetail.Operation
    透传用户信息
    String
    JobLevel
    Response.JobsDetail.Operation
    任务优先级
    String
    WordsGeneralizeResult
    Response.JobsDetail.Operation
    分词结果,任务执行成功时返回
    Container
    Container 节点 WordsGeneralizeResult 的内容:
    节点名称(关键字)
    父节点
    描述
    类型
    WordsGeneralizeLable
    Response.JobsDetail.Operation.WordsGeneralizeResult
    智能分类结果
    Container数组
    WordsGeneralizeToken
    Response.JobsDetail.Operation.WordsGeneralizeResult
    分词详细结果
    Container数组
    Container 节点 WordsGeneralizeLable 的内容:
    节点名称(关键字)
    父节点
    描述
    类型
    Category
    Response.JobsDetail.Operation.WordsGeneralizeResult.WordsGeneralizeLable
    类别
    string
    Word
    Response.JobsDetail.Operation.WordsGeneralizeResult.WordsGeneralizeLable
    词汇
    string
    Container 节点 WordsGeneralizeToken 的内容:
    节点名称(关键字)
    父节点
    描述
    类型
    Word
    Response.JobsDetail.Operation.WordsGeneralizeResult.WordsGeneralizeToken
    词汇
    string
    Offset
    Response.JobsDetail.Operation.WordsGeneralizeResult.WordsGeneralizeToken
    偏移量
    string
    Length
    Response.JobsDetail.Operation.WordsGeneralizeResult.WordsGeneralizeToken
    词汇长度
    string
    Pos
    Response.JobsDetail.Operation.WordsGeneralizeResult.WordsGeneralizeToken
    词性
    string
    词性详见下标:
    英文缩写
    含义
    A
    形容词
    AD
    副形词
    AN
    名形词
    B
    区别词
    C
    连词
    D
    副词
    E
    叹词
    F
    方位词
    G
    语素词
    H
    前接成分
    I
    成语
    J
    简称略语
    K
    后接成分
    L
    习用语
    M
    数词
    N
    名词
    NR
    人名
    NRF
    NRG
    NS
    地名
    NT
    机构团体
    NZ
    其他专名
    NX
    非汉字串
    O
    拟声词
    P
    介词
    Q
    量词
    R
    代词
    S
    处所词
    T
    时间词
    U
    助词
    V
    动词
    VD
    副动词
    VN
    名动词
    W
    标点符号
    X
    非语素字
    Y
    语气词
    Z
    状态词
    AG
    形语素
    BG
    区别语素
    DG
    副语素
    MG
    数词性语素
    NG
    名语素
    QG
    量语素
    RG
    代语素
    TG
    动语素
    VG
    量语素
    YG
    语气词语素
    ZG
    状态词语素
    UNK
    未知词性

    错误码

    该请求操作无特殊错误信息,常见的错误信息请参见 错误码 文档。

    实际案例

    请求

    POST /ai_jobs HTTP/1.1
    Authorization: q-sign-algorithm=sha1&q-ak=AKIDZfbOAo7cllgPvF9cXFrJD0a1ICvR****&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=28e9a4986df11bed0255e97ff90500557e0ea057
    Host: test-123456789.ci.ap-beijing.myqcloud.com
    Content-Length: 166
    Content-Type: application/xml
    
    <Request>
    <Tag>WordsGeneralize</Tag>
    <Input>
    <Object>text.txt</Object>
    </Input>
    <Operation>
    <WordsGeneralize>
    <NerMethod>DL</NerMethod>
    <SegMethod>Mix</SegMethod>
    </WordsGeneralize>
    <UserData>This is my data.</UserData>
    <JobLevel>0</JobLevel>
    </Operation>
    <QueueId>pcd463e1467964d39ad2d3f66aacd8199</QueueId>
    <CallBack>http://callback.demo.com</CallBack>
    <CallBackFormat>JSON<CallBackFormat>
    </Request>

    响应

    HTTP/1.1 200 OK
    Content-Type: application/xml
    Content-Length: 230
    Connection: keep-alive
    Date: Mon, 28 Jun 2022 15:23:12 GMT
    Server: tencent-ci
    x-ci-request-id: NTk0MjdmODlfMjQ4OGY3XzYzYzhf****
    
    <Response>
    <JobsDetail>
    <Code>Success</Code>
    <Message/>
    <JobId>ac7c990a00bf211ed946af9e0691f2b7a</JobId>
    <State>Submitted</State>
    <CreationTime>2022-06-27T14:44:10+0800</CreationTime>
    <StartTime>-</StartTime>
    <EndTime>-</EndTime>
    <QueueId>pcd463e1467964d39ad2d3f66aacd8199</QueueId>
    <Tag>WordsGeneralize</Tag>
    <Input>
    <Object>text.txt</Object>
    </Input>
    <Operation>
    <WordsGeneralize>
    <NerMethod>DL</NerMethod>
    <SegMethod>Mix</SegMethod>
    </WordsGeneralize>
    <UserData>This is my data.</UserData>
    <JobLevel>0</JobLevel>
    </Operation>
    </JobsDetail>
    </Response>
    
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持