Browse Source

添加flag

zfrr 2 months ago
parent
commit
c7ffbc69bd

+ 1 - 1
.idea/BJQA.iml

@@ -2,7 +2,7 @@
 <module type="PYTHON_MODULE" version="4">
   <component name="NewModuleRootManager">
     <content url="file://$MODULE_DIR$" />
-    <orderEntry type="jdk" jdkName="VAE" jdkType="Python SDK" />
+    <orderEntry type="jdk" jdkName="Python 3.9 (BJKG)" jdkType="Python SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
   </component>
   <component name="PyDocumentationSettings">

+ 1 - 1
.idea/misc.xml

@@ -3,5 +3,5 @@
   <component name="Black">
     <option name="sdkName" value="VAE" />
   </component>
-  <component name="ProjectRootManager" version="2" project-jdk-name="VAE" project-jdk-type="Python SDK" />
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (BJKG)" project-jdk-type="Python SDK" />
 </project>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>

BIN
final/ByRules/__pycache__/commonUtil.cpython-39.pyc


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


BIN
final/ByRules/__pycache__/util.cpython-39.pyc


+ 6 - 1
final/ByRules/app.py

@@ -58,7 +58,12 @@ def process_query_route():
             return jsonify(response)
         #  查询类问题:
         if result['type'] == 'query':
-            final_value = smart_find_value(DATA_FOLDER, result["dataJsonName"], result["conditions"], result["target"])
+            if result["flag"]:
+                final_value = smart_find_value(DATA_FOLDER, result["dataJsonName"], result["conditions"], result["target"])
+                final_value = final_value[0]
+            else:
+                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)
             response = {

+ 3 - 1
final/ByRules/similarity_answer_json.py

@@ -521,6 +521,7 @@ def process_query(query, template_dict, json_folder, tokenizer=jieba_tokenizer):
     content = template_info.get("content", "")
     play = template_info.get("play", "")
     qcode = template_info.get("qcode", "")
+    flag = template_info.get("flag", "")
 
     return {
         "matched_key": matched_key,
@@ -538,7 +539,8 @@ def process_query(query, template_dict, json_folder, tokenizer=jieba_tokenizer):
         "find_max": find_max,
         "value_key": value_key,
         "name_key": name_key,
-        "qcode": qcode
+        "qcode": qcode,
+        "flag": flag
     }
 # 查询类
 def smart_find_value(folder_path, file_name, conditions: dict, target_key: str):

+ 2 - 1
final/ByRules/templatesJson/19.json

@@ -6,5 +6,6 @@
   "content": "省间交易正在组织的交易为&",
   "play": "讲述文本",
   "name": "省间交易组织",
-  "unit": "笔"
+  "unit": "笔",
+  "flag": "True"
 }

+ 2 - 1
final/ByRules/templatesJson/20.json

@@ -6,5 +6,6 @@
   "content": "省间交易当月完成的交易为&",
   "play": "讲述文本",
   "name": "省间交易组织",
-  "unit": "笔"
+  "unit": "笔",
+  "flag": "True"
 }

+ 2 - 1
final/ByRules/templatesJson/21.json

@@ -6,5 +6,6 @@
   "content": "省间交易当年完成的交易为&",
   "play": "讲述文本",
   "name": "省间交易组织",
-  "unit": "笔"
+  "unit": "笔",
+  "flag": "True"
 }

+ 2 - 1
final/ByRules/templatesJson/22.json

@@ -6,5 +6,6 @@
   "content": "省间交易当年达成的电量为&",
   "play": "讲述文本",
   "name": "省间交易组织",
-  "unit": "笔"
+  "unit": "笔",
+  "flag": "True"
 }

+ 2 - 1
final/ByRules/templatesJson/23.json

@@ -6,5 +6,6 @@
   "content": "省间交易当年参与交易的家次为&",
   "play": "讲述文本",
   "name": "省间交易组织",
-  "unit": "家"
+  "unit": "家",
+  "flag": "True"
 }