{
  "openapi": "3.0.3",
  "info": {
    "title": "自然语言处理",
    "description": "自然语言处理（Natural Language Processing）是帮助用户高效处理文本的人工智能技术，这项技术可以帮助用户进行舆情内容识别，情感属性量化分析，电商领域文本翻译，文本关键信息抽取，文本快速分类，词性语法分析，相似度检测等。",
    "termsOfService": "https://www.showapi.com/helpcenter/view#/4019/2",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://route.showapi.com"
    }
  ],
  "paths": {
    "/1750-12": {
      "x-pointCode": 12,
      "x-mode": "mapping",
      "x-read-timeout": 50,
      "x-connect-timeout": 25,
      "post": {
        "summary": "依存句法分析",
        "description": "该接口可自动分析文本中的依存句法结构信息，利用句子中词与词之间的依存关系来表示词语的句法结构信息（如“主谓”、“动宾”、“定中”等结构关系），并用树状结构来表示整句的结构（如“主谓宾”、“定状补”等）",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "ret_code": {
                              "type": "number",
                              "description": "0表示成功，其他表示失败"
                            },
                            "remark": {
                              "type": "string",
                              "description": "错误信息"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "items": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "deprel": {
                                          "type": "string",
                                          "description": "词与父节点的依存关系，详情请参考相关文档"
                                        },
                                        "postag": {
                                          "type": "string",
                                          "description": "词性，详情请参考相关文档"
                                        },
                                        "id": {
                                          "type": "number",
                                          "description": "词的id"
                                        },
                                        "word": {
                                          "type": "string",
                                          "description": "词"
                                        },
                                        "head": {
                                          "type": "number",
                                          "description": "词的父节点ID"
                                        }
                                      }
                                    },
                                    "description": "依存关系数组"
                                  },
                                  "text": {
                                    "type": "string",
                                    "description": "原文本"
                                  }
                                }
                              },
                              "description": "分析结果JSON"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "1750_12_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "待分析的中文文本，请示使用utf-8编码，字节数不要超过256个"
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        }
      }
    },
    "/1750-10": {
      "x-pointCode": 10,
      "x-mode": "mapping",
      "x-read-timeout": 50,
      "x-connect-timeout": 20,
      "post": {
        "summary": "短文相似度对比",
        "description": "这个接口可以获得两个文本的相似度得分，可以通过model参数选择不同的对比算法",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "ret_code": {
                              "type": "number",
                              "description": "0表示成功，其他表示失败"
                            },
                            "remark": {
                              "type": "string",
                              "description": "错误信息"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "score": {
                                    "type": "number",
                                    "description": "对比结果取值范围（0,1]"
                                  },
                                  "texts": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "text1": {
                                          "type": "string",
                                          "description": "文本1"
                                        },
                                        "text2": {
                                          "type": "string",
                                          "description": "文本2"
                                        }
                                      }
                                    },
                                    "description": "原文本JSON"
                                  }
                                }
                              },
                              "description": "对比结果JSON"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "1750_10_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "text_1": {
                    "type": "string",
                    "description": "短文1，使用utf-8字符编码，字节数不要超过512个"
                  },
                  "text_2": {
                    "type": "string",
                    "description": "短文2，使用utf-8字符编码，字节数不要超过512个"
                  },
                  "model": {
                    "type": "string",
                    "description": "对比算法，默认为\"BOW\"，可选\"BOW\"、\"CNN\"与\"GRNN\""
                  }
                },
                "required": [
                  "text_1",
                  "text_2"
                ]
              }
            }
          }
        }
      }
    },
    "/1750-7": {
      "x-pointCode": 7,
      "x-mode": "mapping",
      "x-read-timeout": 50,
      "x-connect-timeout": 50,
      "post": {
        "summary": "新闻智能分类",
        "description": "新闻按照内容类型进行自动分类，支持娱乐、体育、科技等26个主流内容类型\r\n目前分类如下：1、国际 2、体育 3、娱乐 4、社会 5、财经 6、时事 7、科技 8、情感 9、汽车 10、教育 11、时尚 12、游戏 13、军事 14、旅游 15、美食 16、文化 17、健康养生 18、搞笑 19、家居 20、动漫 21、宠物 22、母婴育儿 23、星座运势 24、历史 25、音乐 26、综合",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "ret_code": {
                              "type": "number",
                              "description": "0表示成功"
                            },
                            "remark": {
                              "type": "string",
                              "description": "错误信息"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "lv1_tag_list": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "score": {
                                          "type": "number",
                                          "description": "分类得分，取值[0,1]"
                                        },
                                        "tag": {
                                          "type": "string",
                                          "description": "分类名称"
                                        }
                                      }
                                    },
                                    "description": "一级分类数组"
                                  },
                                  "lv2_tag_list": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "score": {
                                          "type": "number",
                                          "description": "分类得分，取值[0,1]"
                                        },
                                        "tag": {
                                          "type": "string",
                                          "description": "分类名称"
                                        }
                                      }
                                    },
                                    "description": "二级分类数组（可能为空）"
                                  }
                                }
                              },
                              "description": "分类结果JSON，其中二级分类数组可能为空"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "1750_7_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "新闻标题"
                  },
                  "content": {
                    "type": "string",
                    "description": "新闻正文内容"
                  }
                },
                "required": [
                  "title",
                  "content"
                ]
              }
            }
          }
        }
      }
    },
    "/1750-5": {
      "x-pointCode": 5,
      "x-mode": "mapping",
      "x-read-timeout": 50,
      "x-connect-timeout": 20,
      "post": {
        "summary": "文章标签提取",
        "description": "该接口对文章的标题和内容进行分析，输出能够反映文章关键信息的主题的标签及对应的置信度。",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "ret_code": {
                              "type": "number",
                              "description": "0表示成功，其他均表示失败"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "items": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "tag": {
                                          "type": "string",
                                          "description": "文章标签"
                                        },
                                        "score": {
                                          "type": "number",
                                          "description": "权重值，在0-1之间取值"
                                        }
                                      }
                                    },
                                    "description": "关键词数组"
                                  }
                                }
                              },
                              "description": "提取的标签结果JSON"
                            },
                            "remark": {
                              "type": "string",
                              "description": "错误信息"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "1750_5_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "文章标题，请使用utf-8编码"
                  },
                  "content": {
                    "type": "string",
                    "description": "正文内容，请使用utf-8编码"
                  }
                },
                "required": [
                  "title",
                  "content"
                ]
              }
            }
          }
        }
      }
    },
    "/1750-4": {
      "x-pointCode": 4,
      "x-mode": "mapping",
      "x-read-timeout": 60,
      "x-connect-timeout": 50,
      "post": {
        "summary": "机器翻译（电商）",
        "description": "该翻译接口目前专用于电商领域的翻译，支持中英，英西，英俄，英法，英葡的互译。按所翻译字符数量每百个字符计费1次，不满百个字符的按1次计费。例如翻译610个字符，则计费7次。",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "Data": {
                              "type": "object",
                              "properties": {
                                "Translated": {
                                  "type": "string",
                                  "description": "翻译结果"
                                },
                                "WordCount": {
                                  "type": "string",
                                  "description": "计费字符数"
                                }
                              }
                            },
                            "ret_code": {
                              "type": "number",
                              "description": "0表示翻译成功，按每百字符计费，例如翻译610个字符，则计费7次"
                            },
                            "remark": {
                              "type": "string",
                              "description": "错误信息"
                            },
                            "RequestId": {
                              "type": "string",
                              "description": "请求id"
                            },
                            "showapi_fee_code": {
                              "type": "number"
                            },
                            "Code": {
                              "type": "string",
                              "description": "200表示成功，101表示参数错误，102表示网络错误，109为未知错误"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "1750_4_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "SourceText": {
                    "type": "string",
                    "description": "待翻译的文本，字符编码请使用utf-8，字节长度不要超过2048"
                  },
                  "SourceLanguage": {
                    "type": "string",
                    "description": "翻译原文语言代码，具体取值：en表示英文，zh表示中文，ru表示俄文，pt表示葡萄牙文，es表示西班牙文，fr表示法文"
                  },
                  "TargetLanguage": {
                    "type": "string",
                    "description": "翻译目标语言代码，具体取值：en表示英文，zh表示中文，ru表示俄文，pt表示葡萄牙文，es表示西班牙文，fr表示法文"
                  },
                  "Scene": {
                    "type": "string",
                    "description": "取值有三个可选，商品标题:title，商品描述:description，商品沟通:communication，不传某认为title"
                  }
                },
                "required": [
                  "SourceText",
                  "SourceLanguage",
                  "TargetLanguage"
                ]
              }
            }
          }
        }
      }
    },
    "/1750-3": {
      "x-pointCode": 3,
      "x-mode": "mapping",
      "x-read-timeout": 50,
      "x-connect-timeout": 20,
      "post": {
        "summary": "文本情感倾向分析",
        "description": "对包含主观观点信息的文本进行情感极性类别（积极、消极、中性）的判断，并给出相应的置信度",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "ret_code": {
                              "type": "number",
                              "description": "0表示成功，其他均表示失败"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "items": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "sentiment": {
                                          "type": "number",
                                          "description": "表示情感极性分类结果"
                                        },
                                        "confidence": {
                                          "type": "number",
                                          "description": "置信度，取值范围在0-1之间"
                                        },
                                        "positive_prob": {
                                          "type": "number",
                                          "description": "可能是积极类别的概率 ，取值范围[0,1]"
                                        },
                                        "negative_prob": {
                                          "type": "number",
                                          "description": "可能是消极类别的概率，取值范围[0.1]"
                                        }
                                      }
                                    },
                                    "description": "结果数组"
                                  },
                                  "text": {
                                    "type": "string",
                                    "description": "原始文本"
                                  }
                                }
                              },
                              "description": "识别结果"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "1750_3_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "待分析的文本，字符编码请使用UTF-8，字节长度不要超过2048个"
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        }
      }
    },
    "/1750-2": {
      "x-pointCode": 2,
      "x-mode": "mapping",
      "x-read-timeout": 52,
      "x-connect-timeout": 25,
      "post": {
        "summary": "命名实体",
        "description": "目前主要针对电商领域，识别品牌、产品、型号等，同时也包括一些通用领域实体如人名、地名、机构名、时间日期等",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "ret_code": {
                              "type": "number",
                              "description": "0表示成功，其他值表示失败"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "word": {
                                    "type": "string",
                                    "description": "单词字符串"
                                  },
                                  "tag": {
                                    "type": "string",
                                    "description": "标签"
                                  },
                                  "synonym": {
                                    "type": "string",
                                    "description": "近义词，若请求时type=simple则没有这个字段返回，这个字段可能返回多个同义词，中间要半角分号分开，也可能返回空"
                                  },
                                  "weight": {
                                    "type": "string",
                                    "description": "权重，若请求时type=simple则没有这个字段返回"
                                  }
                                }
                              },
                              "description": "分析结果"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "1750_2_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "要处理的文本，字符编码请指定为utf-8"
                  },
                  "type": {
                    "type": "string",
                    "description": "控制输出样式，其值可为”simple”或者”full”，分别表示简单输出和详细输出，简单输出包括实体和标签，详细输出包括实体、标签、权重和近义词。"
                  }
                },
                "required": [
                  "text",
                  "type"
                ]
              }
            }
          }
        }
      }
    },
    "/1750-1": {
      "x-pointCode": 1,
      "x-mode": "mapping",
      "x-read-timeout": 50,
      "x-connect-timeout": 20,
      "post": {
        "summary": "分词",
        "description": "能够识别出文本串中的基本词汇，并标注词性",
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ShowapiResEnvelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "showapi_res_body": {
                          "type": "object",
                          "properties": {
                            "ret_code": {
                              "type": "number",
                              "description": "0表示成功，其他表示失败"
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "items": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "item": {
                                          "type": "string",
                                          "description": "分词后的词汇字符串"
                                        },
                                        "ne": {
                                          "type": "string",
                                          "description": "命名实体类型，可能为空"
                                        },
                                        "pos": {
                                          "type": "string",
                                          "description": "词性"
                                        },
                                        "byte_offset": {
                                          "type": "number",
                                          "description": "在text中的字节级offset"
                                        },
                                        "byte_length": {
                                          "type": "number",
                                          "description": "字节级长度"
                                        },
                                        "uri": {
                                          "type": "string",
                                          "description": "命名实体链接到的知识库，可能为空"
                                        },
                                        "basic_words": {
                                          "type": "string",
                                          "description": "分词后的基本次，注意这个字段是个数组"
                                        },
                                        "loc_details": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "description": "成分类型，如省、市、区、县"
                                              },
                                              "byte_offset": {
                                                "type": "number",
                                                "description": "\t在item中的字节级offset"
                                              },
                                              "byte_length": {
                                                "type": "number",
                                                "description": "字节级length"
                                              }
                                            }
                                          },
                                          "description": "地址成分，可能为空数组"
                                        }
                                      }
                                    },
                                    "description": "具体结果"
                                  },
                                  "text": {
                                    "type": "string",
                                    "description": "原始文本"
                                  }
                                }
                              },
                              "description": "结果信息"
                            }
                          },
                          "description": "业务返回体"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "1750_1_POST",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "待分析的文本，字符编码需为utf-8，字节长度不可超过20000"
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "AppKeyAuth": {
        "type": "apiKey",
        "in": "query",
        "name": "appKey",
        "description": "从 ShowAPI 控制台获取的 appKey，管理地址：https://www.showapi.com/console#/myApp"
      }
    },
    "schemas": {
      "ShowapiResEnvelope": {
        "type": "object",
        "description": "ShowAPI 统一返回包裹（业务数据位于 showapi_res_body）",
        "properties": {
          "showapi_res_code": {
            "type": "integer",
            "description": "API 返回的状态码"
          },
          "showapi_res_error": {
            "type": "string",
            "description": "API 返回的错误信息"
          },
          "showapi_res_id": {
            "type": "string",
            "description": "API 请求的唯一标识"
          },
          "showapi_fee_num": {
            "type": "integer",
            "description": "API 调用计费次数"
          }
        }
      }
    }
  },
  "security": [
    {
      "AppKeyAuth": []
    }
  ],
  "externalDocs": {
    "url": "https://www.showapi.com/apiGateway/view/1750?tab=book"
  },
  "x-apiCode": "1750",
  "x-is-own": true,
  "x-is-op": true
}