2 Commits 12ce3986d5 ... b486b20285

Author SHA1 Message Date
  dujunlong b486b20285 合并冲突 2 months ago
  dujunlong a543d89442 djl 2 months ago

BIN
final/ByRules/__pycache__/similarity_answer_json.cpython-38.pyc


+ 1 - 0
final/ByRules/answer.py

@@ -267,6 +267,7 @@ def process_question(question: str):
 # 示例调用
 if __name__ == "__main__":
     # question = "2023年累计省间交易电量是多少?"
+    # question = "2023年年度累计省间交易电量?"   1111
     # question = "2024年12月交易电量是多少?"
     # question = "去年12月交易电量是多少?"
     # question = "前年12月交易电量是多少?"

+ 2 - 2
final/ByRules/app.py

@@ -40,8 +40,8 @@ def process_query_route():
         #  查询类问题:
         if result['type'] == 'query':
             final_value = smart_find_value(DATA_FOLDER, result["dataJsonName"], result["conditions"], result["target"])
-            # final_content = result["content"].replace("&", str(final_value))
-            final_content = fill_template_auto(result['content'], final_value)
+            final_content = result["content"].replace("&", str(final_value))
+            # final_content = fill_template_auto(result['content'], final_value)
             response = {
                 "content": final_content,
                 "content_text": result["content"],

+ 46 - 17
final/ByRules/similarity_answer_json.py

@@ -487,23 +487,52 @@ def find_key_recursively(data, target_key):
 # query = "但同样阿贾克斯大口径的话我可合金外壳设计文件突然发?"
 
 
-query = "当月送出均价最高的是哪个省??"
-
-json_folder = "templatesJson"
-
-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"])
+# query = "2023年省间交易电量新能源交易电量是多少??"
+# query = "2024年省间交易电量按交易周期划分的电量是多少?"
+#
+# json_folder = "templatesJson"
+#
+#
+# json_folder = "templatesJson"
+# #
+# #
+# result = process_query(query, template_dict, json_folder)
+#
+#
+#
+# result = process_query(query, template_dict, json_folder)
+# # print(result)
+# print(result['content'])
+# 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"])
+
+# query = "当月送出均价最高的是哪个省??"
+#
+# json_folder = "templatesJson"
+#
+# 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"])
+
 #
 # type = result["type"]
 # content = result["content"]