|
@@ -4,7 +4,8 @@ import jieba
|
|
|
import os
|
|
|
import json
|
|
|
|
|
|
-from final.ByRules.util import calculate_sum_by_time_range
|
|
|
+from final.ByRules.commonUtil import fill_template_auto
|
|
|
+from final.ByRules.util import calculate_sum_by_time_range, find_max_or_min_value
|
|
|
|
|
|
|
|
|
def jieba_tokenizer(text):
|
|
@@ -36,6 +37,9 @@ template_dict = {
|
|
|
"9.16": ["某年省间交易电量集中交易电量是多少?"],
|
|
|
"9.17": ["某年省间交易电量挂牌交易电量是多少?"],
|
|
|
"17.1": ["那个省送出电量最高?是多少?"],
|
|
|
+ "17.2": ["那个省受入电量最高?是多少?"],
|
|
|
+ "17.3": ["那个省送出电量最低?是多少?"],
|
|
|
+ "17.4": ["那个省受入电量最低?是多少?"],
|
|
|
"19": ["省间交易正在组织的交易有多少?"],
|
|
|
"20": ["省间交易当月完成的交易有多少?"],
|
|
|
"21": ["省间交易当年完成的交易有多少?"],
|
|
@@ -229,7 +233,7 @@ def extract_time_location(question: str) -> Tuple[List[Dict], List[str]]:
|
|
|
def classify_by_time_type(query, time_info):
|
|
|
if not time_info:
|
|
|
# 无时间信息时,返回指定模板 19-23
|
|
|
- return ['19', '20', '21', '22', '23']
|
|
|
+ return ['19', '20', '21', '22', '23', '17.1', '17.2', '17.3', '17.4']
|
|
|
|
|
|
time = time_info[0]
|
|
|
|
|
@@ -465,31 +469,25 @@ def find_key_recursively(data, target_key):
|
|
|
_search(data)
|
|
|
return results
|
|
|
# query = "当月省间交易完成的交易是多少?"
|
|
|
-query = "2023年累计省间交易电量是多少??"
|
|
|
# query = "2024年1月到2月累计交易电量是多少?"
|
|
|
-
|
|
|
-# query = "2024年12月交易电量是多少?"
|
|
|
+# query = "2023年省间交易电量新能源交易电量是多少??"
|
|
|
# # query = "但同样阿贾克斯大口径的话我可合金外壳设计文件突然发?"
|
|
|
-
|
|
|
-query = "2023年省间交易电量新能源交易电量是多少??"
|
|
|
-# query = "但同样阿贾克斯大口径的话我可合金外壳设计文件突然发?"
|
|
|
-
|
|
|
-json_folder = "templatesJson"
|
|
|
+# json_folder = "templatesJson"
|
|
|
+#
|
|
|
#
|
|
|
+# result = process_query(query, template_dict, json_folder)
|
|
|
#
|
|
|
-result = process_query(query, template_dict, json_folder)
|
|
|
-
|
|
|
-print("匹配的模板 key:", result["matched_key"])
|
|
|
-print("最相似的模板句:", result["matched_template"])
|
|
|
-print("相似度分数:", result["similarity_score"])
|
|
|
-print("类型:", result["type"])
|
|
|
-print("关键词:", result["keywords"])
|
|
|
-print("查询字段:", result["target"])
|
|
|
-print("模型名字", result["name"])
|
|
|
-print("条件", result["conditions"])
|
|
|
-print("返回的内容是:", result["content"])
|
|
|
-print("问句是:", result["query"])
|
|
|
-print("动作是:", result["play"])
|
|
|
+# print("匹配的模板 key:", result["matched_key"])
|
|
|
+# print("最相似的模板句:", result["matched_template"])
|
|
|
+# print("相似度分数:", result["similarity_score"])
|
|
|
+# print("类型:", result["type"])
|
|
|
+# print("关键词:", result["keywords"])
|
|
|
+# print("查询字段:", result["target"])
|
|
|
+# print("模型名字", result["name"])
|
|
|
+# print("条件", result["conditions"])
|
|
|
+# print("返回的内容是:", result["content"])
|
|
|
+# print("问句是:", result["query"])
|
|
|
+# print("动作是:", result["play"])
|
|
|
#
|
|
|
# type = result["type"]
|
|
|
# content = result["content"]
|