对应前端功能位置:质检规则配置-测试。专有云URL:ip:port/api/client/TestRule.json。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| IsSchemeData |
integer |
否 |
是否为新版质检,0:旧版质检;1:新版质检。默认为 1 |
1 |
| TestJson |
string |
是 |
测试规则请求参数 JSON,详情见请求参数补充说明。 |
{"ruleList":[9771],"dialogues":[{"begin":0,"end":760,"hourMinSec":"00:00","role":"客户","identity":"客户","words":"123"},{"begin":21004,"end":21494,"hourMinSec":"00:21","role":"客服","identity":"客服","words":"123"}]} |
请求入参示例
{
"ruleList": [
50298
],
"dialogues": [
{
"role": "客服",
"identity": "客服",
"words": "你好,这里是 xx",
"hourMinSec": "00:00",
"begin": 0
},
{
"words": "我要买毛巾",
"begin": 1000,
"role": "客户",
"identity": "客户",
"hourMinSec": "00:01"
}
]
}
请求代码示例
import com.alibaba.fastjson.JSONObject;
import com.aliyun.qualitycheck20190115.Client;
import com.aliyun.qualitycheck20190115.models.*;
import com.aliyun.teaopenapi.models.Config;
public class sca {
private static String ak = "YOUR_ACCESS_KEY_ID";
private static String sk = "YOUR_ACCESS_KEY_SECRET";
private static void testRuleV4() throws Exception {
String json="{\"ruleList\":[50298],\"dialogues\":[{\"role\":\"客服\",\"identity\":\"客服\",\"words\":\"你好,这里是 xx\",\"hourMinSec\":\"00:00\",\"begin\":0},{\"words\":\"我要买毛巾\",\"begin\":1000,\"role\":\"客户\",\"identity\":\"客户\",\"hourMinSec\":\"00:01\"}]}";
Config config = new Config();
config.setAccessKeyId(ak).setAccessKeySecret(sk)
.setEndpoint("qualitycheck.cn-hangzhou.aliyuncs.com")
.setRegionId("cn-hangzhou").setProtocol("HTTPS");
Client client = new Client(config);
TestRuleV4Request result = new TestRuleV4Request();
result.setTestJson(json);
TestRuleV4Response response = client.testRuleV4(result);
System.out.println(JSONObject.toJSONString(response));
}
public static void main(String[] args) throws Exception {
testRuleV4();
}
}
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
PlainResult |
||
| Data |
object |
完整返回内容。 |
|
| HitRuleReviewInfoList |
array<object> |
命中检测项信息。 |
|
|
array<object> |
命中检测项信息。 |
||
| Rid |
integer |
检测项 ID |
451 |
| Lambda |
string |
Lambda 表达式:例如:a&&b |
a&&b |
| ConditionHitInfoList |
array<object> |
命中的条件信息。 |
|
|
array<object> |
命中的条件信息。 |
||
| Cid |
array |
条件 ID。 |
|
|
string |
条件 ID。 |
1 |
|
| Phrase |
object |
当前命中检测项的句子详情。 |
|
| Role |
string |
本句的角色,取值:客服、客户。 |
客服 |
| Identity |
string |
角色标识,离线语音场景下角色只有客服/客户,离线文本质检场景下,显示的是上传数据时传入的 identity。 |
客服 |
| Words |
string |
对话内容。 |
你好,请问有什么可以帮您 |
| Begin |
integer |
这句话的开始时间相对对话整体开始时间的偏移量,毫秒级,例如录音总时长为 2 分 10 秒,客户的某一句话是在 1 分 12 秒时开始讲的,1 分 20 秒时讲完,则 begin 的值为 72000,end 的值为 80000。 |
72000 |
| End |
integer |
这句话的开始时间相对对话整体开始时间的偏移量,毫秒级,例如录音总时长为 2 分 10 秒,客户的某一句话是在 1 分 12 秒时开始讲的,1 分 20 秒时讲完,则 begin 的值为 72000,end 的值为 80000。 |
80000 |
| BeginTime |
string |
这句话的开始时间,示例值:2019-11-25 15:37:16。 |
2019-11-25 15:37:16 |
| HourMinSec |
string |
这句话的时分秒格式的开始时间,格式:hh:mm:ss |
10:00:00 |
| EmotionValue |
integer |
情绪能量值,取值为音量分贝值/10。取值范围:[1,10]。值越高情绪越强烈。 |
7 |
| EmotionFineGrainedValue |
integer |
内部使用,忽略。 |
忽略 |
| SilenceDuration |
integer |
静音时长,单位毫秒 |
1000 |
| SpeechRate |
integer |
本句的平均语速,单位:字数/分钟。 |
100 |
| ChannelId |
integer |
频道 ID。 |
0 |
| Pid |
integer |
当前句子在所有句子中的下标值,即当前句子是请求参数中 dialogue 数组中的第几个,从 0 开始。 |
3 |
| RenterId |
integer |
内部用,忽略。 |
无 |
| Uuid |
string |
内部用,忽略。 |
无 |
| HitStatus |
integer |
命中状态。取值:
|
1 |
| Sid |
integer |
内部用,忽略。 |
无 |
| KeyWords |
array<object> |
命中的关键信息,在复核页面上高亮展示的信息,例如关键词检查算子命中的关键词、客服模型检查算子命中的具体类别信息等。 |
|
|
object |
命中的关键信息,在复核页面上高亮展示的信息,例如关键词检查算子命中的关键词、客服模型检查算子命中的具体类别信息等。 |
||
| OperatorKey |
string |
算子命中的关键信息。 |
无 |
| Val |
string |
算子命中的关键信息,详见下方返回参数说明中的关键信息 Val 详解。 |
你好 |
| Pid |
integer |
当前句子在所有句子中的下标值,即当前句子是请求参数中 dialogue 数组中的第几个,从 0 开始。 |
13 |
| From |
integer |
需要高亮展示的关键字从第几个字符开始,取值范围从 0 开始,最大值为当句话字符总数减 1。高亮的字包含 from。 |
1 |
| To |
integer |
需要高亮展示的关键字到第几个字符结束,最大值为当句话字符总数减 1。高亮的字不包含 to,例如一句话为“不可能给你退货的”,from=0,to=3,那么需要高亮的关键字就是“不可能”三个字。 |
3 |
| Tid |
string |
内部用,忽略。 |
无 |
| Oid |
string |
算子的 ID |
123 |
| Uuid |
string |
内部用,忽略。 |
无 |
| SimilarPhrase |
string |
相似句 |
您好 |
| Cid |
string |
条件 id。 |
4 |
| CustomizeCode |
string |
内部字段,请忽略。 |
无 |
| ConditionInfoList |
array |
条件列表 |
|
| ConditionBasicInfo |
条件信息 |
||
| BranchHitId |
integer |
命中分支 ID。 |
1 |
| BranchInfoList |
array<object> |
分支信息列表 |
|
|
object |
分支信息 |
||
| Index |
integer |
索引号 |
1 |
| Name |
string |
节点名称 |
节点A |
| NextNodeId |
integer |
下一个流程节点 ID |
2 |
| Situation | NextNodeSituations |
流程节点条件 |
|
| Lambda |
string |
Lambda 表达式 |
a&&b |
| CheckType |
integer |
检测项类型 |
0 |
| Triggers |
array |
触发 ID 列表 |
|
|
string |
触发 ID。 |
a |
|
| RuleScoreType |
integer |
是否计分:1 不计分;3 计分。 |
1 |
| TaskFlowId |
integer |
流程 ID |
1 |
| ScoreNumType |
integer |
计分类型,可能值:0(命中后加减分);1(命中后一次性得分) |
1 |
| Matched |
boolean |
是否命中 |
true |
| NodeType |
string |
节点类型。 |
0 |
| JudgeNodeName |
string |
判断节点名称 |
判断节点A |
| RuleName |
string |
规则名称。 |
规则A |
| HitTaskFlowList |
array<object> |
命中高级流程节点列表 |
|
|
object |
命中高级流程节点信息 |
||
| GraphFlow | TaskGraphFlow |
图流程画布 |
|
| TaskFlowType |
integer |
流程图类型-已废弃-默认-1 |
无 |
| Rid |
integer |
规则 ID |
1 |
| UnhitRuleReviewInfoList |
array<object> |
未命中规则信息 |
|
|
object |
未命中规则信息 |
||
| Rid |
integer |
命中的规则 ID。 |
2 |
| ConditionInfoList |
array |
条件列表 |
|
| ConditionBasicInfo |
条件信息 |
||
| Matched |
boolean |
是否命中 |
true |
| TaskFlowType |
integer |
流程图类型-已废弃-默认-1 |
忽略 |
| RequestId |
string |
请求 ID。 |
96138D8D-XXXX-4E41-XXXX-77AED1088BBD |
| Success |
boolean |
请求是否成功,调用方可根据此字段来判断请求是否成功:true 表示成功;false/null 表示失败。 |
true |
| Code |
string |
结果代码,200 表示成功,若为别的值则表示失败,调用方可根据此字段判断失败原因。 |
200 |
| Message |
string |
出错时表示出错详情,成功时为 successful。 |
successful |
| HttpStatusCode |
integer |
HTTP 状态码。 |
200 |
示例
正常返回示例
JSON格式
{
"Data": {
"HitRuleReviewInfoList": [
{
"Rid": 451,
"Lambda": "a&&b",
"ConditionHitInfoList": [
{
"Cid": [
"1"
],
"Phrase": {
"Role": "客服",
"Identity": "客服",
"Words": "你好,请问有什么可以帮您",
"Begin": 72000,
"End": 80000,
"BeginTime": "2019-11-25 15:37:16",
"HourMinSec": "10:00:00",
"EmotionValue": 7,
"EmotionFineGrainedValue": 0,
"SilenceDuration": 1000,
"SpeechRate": 100,
"ChannelId": 0,
"Pid": 3,
"RenterId": 0,
"Uuid": "无",
"HitStatus": 1,
"Sid": 0
},
"KeyWords": [
{
"OperatorKey": "无",
"Val": "你好",
"Pid": 13,
"From": 1,
"To": 3,
"Tid": "无",
"Oid": "123",
"Uuid": "无",
"SimilarPhrase": "您好",
"Cid": "4",
"CustomizeCode": "无"
}
]
}
],
"ConditionInfoList": [
{
"Cid": "a",
"Id": 1,
"Rid": "1",
"Check_range": {
"RoleId": 1,
"Role": "客服",
"Anchor": {
"Cid": "a",
"Location": "BEFORE",
"Hit_time": 1
},
"Range": {
"From": 1,
"To": 2
},
"Absolute": true,
"AllSentencesSatisfy": true
},
"Operators": [
{
"Oid": "a",
"Id": 1,
"Type": "HIT_ANY_KEYWORDS",
"Param": {
"CustomerParam": {
"Field": "remark1",
"FieldType": 1,
"DataType": 1,
"Symbol": 1,
"Value": "xxx",
"ActualValue": "xx",
"ExpressionMetaDesc": {
"LeftFieldType": 0,
"LeftOperand": "",
"Operator": "",
"RightFieldType": 0,
"RightOperand": "",
"RoundingMode": ""
}
},
"Keywords": [
"你好"
],
"Regex": "质疑.*",
"NotRegex": "优秀.*",
"Phrase": "你好,请问",
"References": [
"你好.{0,10}"
],
"Interval": 1,
"IntervalEnd": 2,
"Threshold": 90,
"In_sentence": true,
"Target": 1,
"From_end": true,
"Different_role": true,
"Target_role": "客服",
"RoleId": 1,
"Velocity": 111,
"VelocityInMint": 1,
"KeywordExtension": 1,
"Synonyms": {
"key": [
"售卖"
]
},
"Case_sensitive": true,
"Near_dialogue": true,
"MinWordSize": 1,
"Hit_time": 2,
"Excludes": [
"负向"
],
"From": 0,
"CheckFirstSentence": true,
"Average": true,
"BeginType": "1",
"EndType": "2",
"CompareOperator": "gt",
"Pkey": "xx",
"Poutput_type": 1,
"SimilarlySentences": [
"我要购买"
],
"LgfSentences": [
"你好{1}"
],
"Score": 70,
"ContextChatMatch": true,
"KeywordMatchSize": 1,
"MaxEmotionChangeValue": 3,
"CheckType": 1,
"KnowledgeTargetId": "1",
"CategoryPathCode": "xx",
"KnowledgeTargetType": 1,
"KnowledgeTargetName": "订单",
"QuestionThreshold": "90",
"AnswerThreshold": "90",
"KnowledgeSentenceNum": 1,
"KnowledgeInfo": "下单",
"BotId": "chatbot-cn-xxx",
"UseEasAlgorithm": true,
"Pvalues": [
""
],
"Similarity_threshold": 90,
"AntModelInfo": {
"key": "xxx"
},
"DelayTime": 10
},
"Name": "a",
"UserGroup": "xxx",
"QualityCheckType": 0
}
],
"Lambda": "a",
"Exclusion": 0,
"Name": "xx",
"UserGroup": "xxxx"
}
],
"BranchHitId": 1,
"BranchInfoList": [
{
"Index": 1,
"Name": "节点A",
"NextNodeId": 2,
"Situation": {
"ConditionGroup": [
{
"Conditions": [
{
"Field": "remark1",
"FieldType": 1,
"DataType": 1,
"Symbol": 1,
"Value": "xxx",
"ActualValue": "xx",
"ExpressionMetaDesc": {
"LeftFieldType": 0,
"LeftOperand": "",
"Operator": "",
"RightFieldType": 0,
"RightOperand": "",
"RoundingMode": ""
}
}
],
"Type": "1"
}
],
"Type": "1"
},
"Lambda": "a&&b",
"CheckType": 0,
"Triggers": [
"a"
]
}
],
"RuleScoreType": 1,
"TaskFlowId": 1,
"ScoreNumType": 1,
"Matched": true,
"NodeType": "0",
"JudgeNodeName": "判断节点A",
"RuleName": "规则A"
}
],
"HitTaskFlowList": [
{
"GraphFlow": {
"Id": 1,
"Rid": 1,
"RuleName": "违规",
"SkipWhenFirstSessionNodeMiss": true,
"FlowRuleScoreType": 1,
"ShowProperties": "{}",
"Nodes": [
{
"Id": 1,
"Rid": 1,
"Name": "开始节点",
"NodeType": "startNode",
"Index": 1,
"Content": "{}",
"Properties": {
"Type": "xx",
"Role": "客户",
"SayType": "",
"RuleScoreType": 1,
"ScoreNum": 1,
"ScoreType": 1,
"ScoreRuleHitType": 0,
"AutoReview": 1,
"ScoreNumType": 1,
"Lambda": "a",
"CheckType": 1,
"Triggers": [
"a"
],
"BranchJudge": true,
"CheckMoreSize": 1
},
"Conditions": [
{
"Cid": "a",
"Id": 1,
"Rid": "1",
"Check_range": {
"RoleId": 1,
"Role": "客服",
"Anchor": {
"Cid": "a",
"Location": "BEFORE",
"Hit_time": 1
},
"Range": {
"From": 1,
"To": 2
},
"Absolute": true,
"AllSentencesSatisfy": true
},
"Operators": [
{
"Oid": "a",
"Id": 1,
"Type": "HIT_ANY_KEYWORDS",
"Param": {
"CustomerParam": {
"Field": "remark1",
"FieldType": 1,
"DataType": 1,
"Symbol": 1,
"Value": "xxx",
"ActualValue": "xx",
"ExpressionMetaDesc": {
"LeftFieldType": 0,
"LeftOperand": "",
"Operator": "",
"RightFieldType": 0,
"RightOperand": "",
"RoundingMode": ""
}
},
"Keywords": [
"你好"
],
"Regex": "质疑.*",
"NotRegex": "优秀.*",
"Phrase": "你好,请问",
"References": [
"你好.{0,10}"
],
"Interval": 1,
"IntervalEnd": 2,
"Threshold": 90,
"In_sentence": true,
"Target": 1,
"From_end": true,
"Different_role": true,
"Target_role": "客服",
"RoleId": 1,
"Velocity": 111,
"VelocityInMint": 1,
"KeywordExtension": 1,
"Synonyms": {
"key": [
"售卖"
]
},
"Case_sensitive": true,
"Near_dialogue": true,
"MinWordSize": 1,
"Hit_time": 2,
"Excludes": [
"负向"
],
"From": 0,
"CheckFirstSentence": true,
"Average": true,
"BeginType": "1",
"EndType": "2",
"CompareOperator": "gt",
"Pkey": "xx",
"Poutput_type": 1,
"SimilarlySentences": [
"我要购买"
],
"LgfSentences": [
"你好{1}"
],
"Score": 70,
"ContextChatMatch": true,
"KeywordMatchSize": 1,
"MaxEmotionChangeValue": 3,
"CheckType": 1,
"KnowledgeTargetId": "1",
"CategoryPathCode": "xx",
"KnowledgeTargetType": 1,
"KnowledgeTargetName": "订单",
"QuestionThreshold": "90",
"AnswerThreshold": "90",
"KnowledgeSentenceNum": 1,
"KnowledgeInfo": "下单",
"BotId": "chatbot-cn-xxx",
"UseEasAlgorithm": true,
"Pvalues": [
""
],
"Similarity_threshold": 90,
"AntModelInfo": {
"key": "xxx"
},
"DelayTime": 10
},
"Name": "a",
"UserGroup": "xxx",
"QualityCheckType": 0
}
],
"Lambda": "a",
"Exclusion": 0,
"Name": "xx",
"UserGroup": "xxxx"
}
],
"NextNodes": [
{
"Index": 1,
"Name": "a",
"NextNodeId": 31533,
"Lambda": "a",
"CheckType": 1,
"Triggers": [
"a"
]
}
],
"UseConditions": true
}
]
},
"TaskFlowType": 0,
"Rid": 1
}
],
"UnhitRuleReviewInfoList": [
{
"Rid": 2,
"ConditionInfoList": [
{
"Cid": "a",
"Id": 1,
"Rid": "1",
"Check_range": {
"RoleId": 1,
"Role": "客服",
"Anchor": {
"Cid": "a",
"Location": "BEFORE",
"Hit_time": 1
},
"Range": {
"From": 1,
"To": 2
},
"Absolute": true,
"AllSentencesSatisfy": true
},
"Operators": [
{
"Oid": "a",
"Id": 1,
"Type": "HIT_ANY_KEYWORDS",
"Param": {
"Keywords": [
"你好"
],
"Regex": "质疑.*",
"NotRegex": "优秀.*",
"Phrase": "你好,请问",
"References": [
"你好.{0,10}"
],
"Interval": 1,
"IntervalEnd": 2,
"Threshold": 90,
"In_sentence": true,
"Target": 1,
"From_end": true,
"Different_role": true,
"Target_role": "客服",
"RoleId": 1,
"Velocity": 111,
"VelocityInMint": 1,
"KeywordExtension": 1,
"Synonyms": {
"key": [
"售卖"
]
},
"Case_sensitive": true,
"Near_dialogue": true,
"MinWordSize": 1,
"Hit_time": 2,
"Excludes": [
"负向"
],
"From": 0,
"CheckFirstSentence": true,
"Average": true,
"BeginType": "1",
"EndType": "2",
"CompareOperator": "gt",
"Pkey": "xx",
"Poutput_type": 1,
"SimilarlySentences": [
"我要购买"
],
"LgfSentences": [
"你好{1}"
],
"Score": 70,
"ContextChatMatch": true,
"KeywordMatchSize": 1,
"MaxEmotionChangeValue": 3,
"CheckType": 1,
"KnowledgeTargetId": "1",
"CategoryPathCode": "xx",
"KnowledgeTargetType": 1,
"KnowledgeTargetName": "订单",
"QuestionThreshold": "90",
"AnswerThreshold": "90",
"KnowledgeSentenceNum": 1,
"KnowledgeInfo": "下单",
"BotId": "chatbot-cn-xxx",
"UseEasAlgorithm": true,
"Pvalues": [
""
],
"Similarity_threshold": 90,
"AntModelInfo": {
"key": "xxx"
},
"DelayTime": 10
},
"Name": "a",
"UserGroup": "xxx",
"QualityCheckType": 0
}
],
"Lambda": "a",
"Exclusion": 0,
"Name": "xx",
"UserGroup": "xxxx"
}
],
"Matched": true,
"TaskFlowType": 0
}
]
},
"RequestId": "96138D8D-XXXX-4E41-XXXX-77AED1088BBD",
"Success": true,
"Code": "200",
"Message": "successful",
"HttpStatusCode": 200
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。