Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
6debcbc1bd
54
api/main.py
54
api/main.py
|
|
@ -23,16 +23,18 @@ labels = [
|
||||||
|
|
||||||
# 标签映射
|
# 标签映射
|
||||||
label_map = {
|
label_map = {
|
||||||
0: 'O', 1: 'B-date', 11: 'I-date',
|
0: 'O', # 非实体
|
||||||
2: 'B-projectName', 12: 'I-projectName',
|
1: 'B-date', 12: 'I-date',
|
||||||
3: 'B-projectType', 13: 'I-projectType',
|
2: 'B-project_name', 13: 'I-project_name',
|
||||||
4: 'B-constructionUnit', 14: 'I-constructionUnit',
|
3: 'B-project_type', 14: 'I-project_type',
|
||||||
5: 'B-implementationOrganization', 15: 'I-implementationOrganization',
|
4: 'B-construction_unit', 15: 'I-construction_unit',
|
||||||
6: 'B-projectDepartment', 16: 'I-projectDepartment',
|
5: 'B-implementation_organization', 16: 'I-implementation_organization',
|
||||||
7: 'B-projectManager', 17: 'I-projectManager',
|
6: 'B-project_department', 17: 'I-project_department',
|
||||||
8: 'B-subcontractor', 18: 'I-subcontractor',
|
7: 'B-project_manager', 18: 'I-project_manager',
|
||||||
9: 'B-teamLeader', 19: 'I-teamLeader',
|
8: 'B-subcontractor', 19: 'I-subcontractor',
|
||||||
10: 'B-riskLevel', 20: 'I-riskLevel'
|
9: 'B-team_leader', 20: 'I-team_leader',
|
||||||
|
10: 'B-risk_level', 21: 'I-risk_level',
|
||||||
|
11: 'B-page', 22: 'I-page',
|
||||||
}
|
}
|
||||||
|
|
||||||
# 初始化工具类
|
# 初始化工具类
|
||||||
|
|
@ -208,22 +210,22 @@ def agent():
|
||||||
|
|
||||||
print(f"多轮意图识别后的label:{predicted_label}, id:{predicted_id},槽位抽取后的实体:{entities},message:{messages}")
|
print(f"多轮意图识别后的label:{predicted_label}, id:{predicted_id},槽位抽取后的实体:{entities},message:{messages}")
|
||||||
|
|
||||||
#必须槽位缺失检查
|
# #必须槽位缺失检查
|
||||||
status, sk = check_lost(predicted_id, entities)
|
# status, sk = check_lost(predicted_id, entities)
|
||||||
if status == CheckResult.NEEDS_MORE_ROUNDS:
|
# if status == CheckResult.NEEDS_MORE_ROUNDS:
|
||||||
return jsonify({"code": 10001, "msg": "成功",
|
# return jsonify({"code": 10001, "msg": "成功",
|
||||||
"answer": { "miss": sk},
|
# "answer": { "miss": sk},
|
||||||
})
|
# })
|
||||||
|
#
|
||||||
#工程名和项目名标准化
|
# #工程名和项目名标准化
|
||||||
print(f"start to check_project_standard_slot")
|
# print(f"start to check_project_standard_slot")
|
||||||
result, information = check_project_standard_slot(predicted_id, entities)
|
# result, information = check_project_standard_slot(predicted_id, entities)
|
||||||
print(f"end check_project_standard_slot,{result},{information}")
|
# print(f"end check_project_standard_slot,{result},{information}")
|
||||||
if result == CheckResult.NEEDS_MORE_ROUNDS:
|
# if result == CheckResult.NEEDS_MORE_ROUNDS:
|
||||||
return jsonify({
|
# return jsonify({
|
||||||
"code": 10001, "msg": "成功",
|
# "code": 10001, "msg": "成功",
|
||||||
"answer": {"miss": information},
|
# "answer": {"miss": information},
|
||||||
})
|
# })
|
||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
"code": 200,"msg": "成功",
|
"code": 200,"msg": "成功",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue