|
@@ -5,6 +5,7 @@ import os
|
|
|
import json
|
|
|
|
|
|
|
|
|
+
|
|
|
def jieba_tokenizer(text):
|
|
|
return list(jieba.cut(text))
|
|
|
# 定义问题模板
|
|
@@ -34,6 +35,9 @@ template_dict = {
|
|
|
"9.16": ["某年省间交易电量集中交易电量是多少?"],
|
|
|
"9.17": ["某年省间交易电量挂牌交易电量是多少?"],
|
|
|
"17.1": ["那个省送出电量最高?是多少?"],
|
|
|
+ "17.2": ["那个省受入电量最高?是多少?"],
|
|
|
+ "17.3": ["那个省送出电量最低?是多少?"],
|
|
|
+ "17.4": ["那个省受入电量最低?是多少?"],
|
|
|
"19": ["省间交易正在组织的交易有多少?"],
|
|
|
"20": ["省间交易当月完成的交易有多少?"],
|
|
|
"21": ["省间交易当年完成的交易有多少?"],
|
|
@@ -227,7 +231,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]
|
|
|
|
|
@@ -463,20 +467,27 @@ 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"])
|