自然语言处理 NLP-多粒度分词:响应示例

时间:2024-01-17 15:35:04

响应示例

  • 成功响应示例1
    {
      "result": [
        "华为技术有限公司",
        "的",
        "总部"
      ]
    }
  • 成功响应示例2
    {
      "result": [
        {
          "content": "华为技术有限公司",
          "sub_contents": [
            {
              "content": "华为",
              "sub_contents": [
                {
                  "content": "华",
                  "type": "CHAR"
                },
                {
                  "content": "为",
                  "type": "CHAR"
                }
              ],
              "type": "WORD"
            },
            {
              "content": "技术",
              "sub_contents": [
                {
                  "content": "技",
                  "type": "CHAR"
                },
                {
                  "content": "术",
                  "type": "CHAR"
                }
              ],
              "type": "WORD"
            },
            {
              "content": "有限公司",
              "sub_contents": [
                {
                  "content": "有限",
                  "sub_contents": [
                    {
                      "content": "有",
                      "type": "CHAR"
                    },
                    {
                      "content": "限",
                      "type": "CHAR"
                    }
                  ],
                  "type": "WORD"
                },
                {
                  "content": "公司",
                  "sub_contents": [
                    {
                      "content": "公",
                      "type": "CHAR"
                    },
                    {
                      "content": "司",
                      "type": "CHAR"
                    }
                  ],
                  "type": "WORD"
                }
              ],
              "type": "WORD"
            }
          ],
          "type": "WORD"
        },
        {
          "content": "的",
          "sub_contents": [
            {
              "content": "的",
              "type": "CHAR"
            }
          ],
          "type": "WORD"
        },
        {
          "content": "总部",
          "sub_contents": [
            {
              "content": "总",
              "type": "CHAR"
            },
            {
              "content": "部",
              "type": "CHAR"
            }
          ],
          "type": "WORD"
        }
      ]
    }
  • 失败响应示例
    {
        "error_code": "NLP.0301",
        "error_msg": "the length of the text must between 1-64"
    }
support.huaweicloud.com/api-nlp/nlp_03_0075.html