全部产品

电销场景对话疑似诈骗识别

电销场景对话风险识别服务适用于电话销售外呼场景,识别有诈骗风险的对话,可应用于语音质检。使用示例如下。

Java代码示例

  1. class MsgDO{
  2. private String role;
  3. private String words;
  4. public MsgDO(String role,String words) {
  5. this.role = role;
  6. this.words = words;
  7. }
  8. public String getRole() {
  9. return role;
  10. }
  11. public void setRole(String role) {
  12. this.role = role;
  13. }
  14. public String getWords() {
  15. return words;
  16. }
  17. public void setWords(String words) {
  18. this.words = words;
  19. }
  20. }
  21. DefaultProfile defaultProfile = DefaultProfile.getProfile("cn-hangzhou","your-access-id-key","your-access-id-secret");
  22. IAcsClient client = new DefaultAcsClient(defaultProfile);
  23. Map<String, Object> obj = new HashMap<String, Object>();
  24. List<MsgDO> msgs = new ArrayList<MsgDO>();
  25. msgs.add(new MsgDO("客服","我是公安局。"));
  26. msgs.add(new MsgDO("客户","你好"));
  27. msgs.add(new MsgDO("客服","加一下您的扣扣好吗"));
  28. obj.put("msgs",msgs);
  29. obj.put("session_id",123);
  30. RunPreTrainServiceRequest request = new RunPreTrainServiceRequest();
  31. request.setServiceName("暂不直接开放,请加 阿里云NLP自学习平台用户答疑群23142693 联系获取");
  32. request.setPredictContent(JSON.toJSONString(obj));
  33. RunPreTrainServiceResponse response = client.getAcsResponse(request);
  34. System.out.println(response.getPredictResult());

Python代码示例

  1. # 安装依赖
  2. pip install aliyun-python-sdk-core
  3. pip install aliyun-python-sdk-nlp-automl
  1. # -*- coding: utf8 -*-
  2. import json
  3. from aliyunsdkcore.client import AcsClient
  4. from aliyunsdkcore.acs_exception.exceptions import ClientException
  5. from aliyunsdkcore.acs_exception.exceptions import ServerException
  6. from aliyunsdknlp_automl.request.v20191111 import RunPreTrainServiceRequest
  7. # Initialize AcsClient instance
  8. client = AcsClient(
  9. "<your-access-key-id>",
  10. "<your-access-key-secret>",
  11. "cn-hangzhou"
  12. );
  13. content = {
  14. "session_id": 123,
  15. "msgs":[
  16. {
  17. "role": "客服",
  18. "words": "我是公安局。"
  19. },
  20. {
  21. "role": "客户",
  22. "words": "你好 "
  23. },
  24. {
  25. "role": "客服",
  26. "words": "加一下您的扣扣好吗 "
  27. }
  28. ]
  29. }
  30. # Initialize a request and set parameters
  31. request = RunPreTrainServiceRequest.RunPreTrainServiceRequest()
  32. request.set_ServiceName("暂不直接开放,请加 阿里云NLP自学习平台用户答疑群23142693 联系获取")
  33. request.set_PredictContent(json.dumps(content))
  34. # Print response
  35. response = client.do_action_with_exception(request)
  36. resp_obj = json.loads(response)
  37. predict_result = json.loads(resp_obj['PredictResult'])
  38. print(predict_result)

PredictContent内容示例

  1. {
  2. "session_id": 123,
  3. "msgs":[
  4. {
  5. "role": "客服",
  6. "words": "我是公安局。"
  7. },
  8. {
  9. "role": "客户",
  10. "words": "你好 "
  11. },
  12. {
  13. "role": "客服",
  14. "words": "加一下您的扣扣好吗 "
  15. }
  16. ]
  17. }

PredictResult内容示例

  1. {
  2. 'session_id': '123',
  3. 'cost': '82.554ms',
  4. 'result': '疑似诈骗',
  5. 'code': 'SUCCESS'
  6. }

入参说明

参数 说明
session_id 当前请求唯一标识(字符串),为便于排查问题,请务必加上。可以是md5,或者随机数加时间戳。(必选字段)
msgs 对话内容(必选字段)
role 说话人的角色,当前仅客服、客户两种角色
words 说话人的说话内容

出参说明

参数 说明
session_id 唯一标识
result 正常 或 疑似诈骗
code 查询状态,SUCCESS为成功,INVALID_INPUT_FORMAT 为输入格式错误,FIELD_MISSING 为必选字段缺失,INVALID_TEXT_VALUE 为msgs字段无有效值
cost 查询耗时