技术文档中心
全面的开发指南、API文档与最佳实践,助您轻松集成川意科技的产品和服务
API端点文档
本页面提供川意科技API所有可用端点的详细说明,包括请求方法、URL、必要参数、请求体格式以及响应示例。使用这些API可以集成我们的人工智能、数据分析和云服务能力到您的应用中。
基础信息
API地址
所有API请求都应使用以下基础URL:
https://api.chuanyi-tech.com/v2/
请求格式
所有请求都应使用JSON格式,并设置以下请求头:
Content-Type: application/json
文本分析端点
自然语言处理
文本分析
POST/analysis/text/sentiment
情感分析
分析文本内容的情感倾向,识别积极、消极或中性情绪,并提供相应的置信度分数和关键情感词汇。
请求参数
{
"text": "需要分析的文本内容", // 必填,要分析的文本
"language": "zh", // 可选,语言代码:zh (中文), en (英文),默认自动检测
"options": {
"detailed": true, // 可选,是否返回详细分析,默认false
"keywords": true // 可选,是否返回情感关键词,默认false
}
}
响应示例
{
"status": "success",
"data": {
"sentiment": "positive", // positive, negative, neutral
"confidence": 0.85, // 置信度 (0-1)
"details": { // 当options.detailed=true时存在
"positiveAspects": ["服务态度好", "价格合理"],
"negativeAspects": [],
"summary": "整体评价积极"
},
"keywords": [ // 当options.keywords=true时存在
{
"word": "服务态度好",
"sentiment": "positive",
"weight": 0.7
},
{
"word": "价格合理",
"sentiment": "positive",
"weight": 0.5
}
]
}
}
POST/analysis/text/entity
实体识别
从文本中识别和提取命名实体,如人名、地点、组织机构、日期、货币金额等,并分类标注。
请求参数
{
"text": "需要分析的文本内容", // 必填,要分析的文本
"language": "zh", // 可选,语言代码:zh (中文), en (英文),默认自动检测
"entityTypes": ["PERSON", "LOCATION", "ORGANIZATION"], // 可选,需要识别的实体类型列表
"options": {
"includePositions": true // 可选,是否返回实体在文本中的位置,默认false
}
}
响应示例
{
"status": "success",
"data": {
"entities": [
{
"text": "李明",
"type": "PERSON",
"confidence": 0.96,
"positions": [ // 当options.includePositions=true时存在
{
"start": 5,
"end": 7
}
]
},
{
"text": "北京",
"type": "LOCATION",
"confidence": 0.98,
"positions": [
{
"start": 12,
"end": 14
}
]
},
{
"text": "川意科技",
"type": "ORGANIZATION",
"confidence": 0.93,
"positions": [
{
"start": 18,
"end": 22
}
]
}
],
"summary": { // 实体统计信息
"PERSON": 1,
"LOCATION": 1,
"ORGANIZATION": 1
}
}
}
图像分析端点
计算机视觉
图像处理
POST/analysis/image/object-detection
对象检测
在图像中检测和识别物体,返回物体类别、位置和置信度。支持多种常见物体类别如人、车辆、动物等。
请求参数
{
"image": "BASE64_ENCODED_IMAGE_DATA", // 必填,Base64编码的图像数据
// 或者使用URL
"imageUrl": "https://example.com/image.jpg", // 图像URL,与image二选一
"minConfidence": 0.6, // 可选,最小置信度阈值(0-1),默认0.5
"maxResults": 10, // 可选,最大返回结果数,默认不限制
"options": {
"returnBoundingBoxes": true, // 可选,是否返回边界框,默认true
"returnAttributes": false // 可选,是否返回对象属性,默认false
}
}
响应示例
{
"status": "success",
"data": {
"objects": [
{
"class": "person",
"confidence": 0.95,
"boundingBox": {
"x": 120,
"y": 80,
"width": 100,
"height": 200
},
"attributes": { // 当options.returnAttributes=true时存在
"gender": "male",
"age": "adult",
"clothing": "casual"
}
},
{
"class": "car",
"confidence": 0.87,
"boundingBox": {
"x": 300,
"y": 150,
"width": 250,
"height": 120
},
"attributes": {
"color": "blue",
"type": "sedan"
}
}
],
"summary": {
"totalObjects": 2,
"objectClasses": ["person", "car"]
},
"imageInfo": {
"width": 800,
"height": 600,
"format": "JPEG"
}
}
}
POST/analysis/image/ocr
文字识别
从图像中提取和识别文字内容,支持多种语言和字体样式。可以识别自然场景中的文字、文档扫描件和表格等。
请求参数
{
"image": "BASE64_ENCODED_IMAGE_DATA", // 必填,Base64编码的图像数据
// 或者使用URL
"imageUrl": "https://example.com/image.jpg", // 图像URL,与image二选一
"languages": ["zh", "en"], // 可选,识别语言列表,默认自动检测
"options": {
"detectOrientation": true, // 可选,是否检测文字方向,默认false
"returnPositions": true, // 可选,是否返回文字位置,默认false
"returnConfidence": true // 可选,是否返回置信度,默认false
}
}
响应示例
{
"status": "success",
"data": {
"text": "川意科技
人工智能解决方案提供商", // 完整识别文本
"orientation": 0, // 文字方向 (0, 90, 180, 270),当options.detectOrientation=true时存在
"lines": [
{
"text": "川意科技",
"confidence": 0.98, // 当options.returnConfidence=true时存在
"position": { // 当options.returnPositions=true时存在
"x": 100,
"y": 50,
"width": 200,
"height": 40
},
"words": [
{
"text": "川意",
"confidence": 0.99,
"position": {
"x": 100,
"y": 50,
"width": 80,
"height": 40
}
},
{
"text": "科技",
"confidence": 0.97,
"position": {
"x": 180,
"y": 50,
"width": 80,
"height": 40
}
}
]
},
{
"text": "人工智能解决方案提供商",
"confidence": 0.95,
"position": {
"x": 80,
"y": 100,
"width": 300,
"height": 40
},
"words": [
// 单词详情
]
}
],
"language": "zh" // 检测到的主要语言
}
}
数据处理端点
数据分析
数据清洗
POST/data/transform
数据转换
对结构化数据进行转换处理,支持格式转换、字段映射、数据过滤等操作。能处理CSV、JSON、XML等多种数据格式。
请求参数
{
"data": [
// 输入数据数组或对象
],
"sourceFormat": "json", // 必填,源数据格式:json, csv, xml
"targetFormat": "csv", // 必填,目标数据格式:json, csv, xml
"mappings": [ // 可选,字段映射规则
{
"source": "user_id",
"target": "id",
"transform": "string" // 可选的数据类型转换
},
{
"source": "user_name",
"target": "name"
}
],
"filters": [ // 可选,数据过滤规则
{
"field": "age",
"operator": "gte", // gt, lt, gte, lte, eq, neq, in, contains
"value": 18
}
],
"options": {
"includeHeaders": true, // 对CSV格式,是否包含表头,默认true
"delimiter": "," // 对CSV格式,分隔符,默认逗号
}
}
响应示例
{
"status": "success",
"data": {
"result": "id,name,age
1001,张三,25
1002,李四,30", // 或JSON/XML格式的数据
"summary": {
"totalRows": 2,
"processedRows": 2,
"filteredRows": 1,
"format": "csv"
}
}
}
POST/data/analyze
数据分析
对数据集进行统计分析,生成描述性统计指标、数据分布、相关性分析等结果。适用于业务数据分析和科学研究。
请求参数
{
"data": [
// 输入数据数组
],
"analyses": [ // 必填,分析类型列表
"summary", // 描述性统计
"distribution", // 数据分布
"correlation", // 相关性分析
"clustering" // 聚类分析
],
"fields": ["sales", "region", "date"], // 可选,需要分析的字段列表,默认全部
"options": {
"confidenceLevel": 0.95, // 可选,统计置信水平,默认0.95
"includeVisualizations": false // 可选,是否包含可视化数据,默认false
}
}
响应示例
{
"status": "success",
"data": {
"summary": {
"fields": {
"sales": {
"count": 1000,
"mean": 5432.8,
"median": 4500,
"min": 100,
"max": 25000,
"std": 3245.6,
"variance": 10533922.56
},
"region": {
"count": 1000,
"unique": 5,
"mostCommon": "东区",
"frequencies": {
"东区": 300,
"南区": 250,
"西区": 200,
"北区": 150,
"中区": 100
}
}
}
},
"distribution": {
"sales": {
"histogram": [
{"bin": "0-5000", "count": 400},
{"bin": "5001-10000", "count": 350},
{"bin": "10001-15000", "count": 150},
{"bin": "15001-20000", "count": 80},
{"bin": "20001-25000", "count": 20}
],
"normalityTest": {
"testName": "Shapiro-Wilk",
"pValue": 0.03,
"isNormal": false
}
}
},
"correlation": {
"matrix": [
// 相关性矩阵
],
"strongest": {
"fields": ["sales", "date"],
"value": 0.78,
"type": "positive"
}
}
}
}