Forráskód Böngészése

documnet_.py修改

lfygithub01 1 éve
szülő
commit
faf0969e64
1 módosított fájl, 53 hozzáadás és 15 törlés
  1. 53 15
      document_.py

+ 53 - 15
document_.py

@@ -78,14 +78,14 @@ class DocumentPreReview():
         ''' get table data
         '''
         # file_path = "data/预审查数据/all_tables.json"
-        file_path = "data/预审查数据/三峡左岸及电源电站中央空调系统监控系统改造招标文件-发售版-table.json"
+        file_path = "data/预审查数据/2023年档案管理系统功能优化项目采购程序文件-table.json"
         all_tables = self.bm.json_read(file_path)
         return all_tables
     
     def get_Bidding_json(self):
         ''' read json to get context
         '''
-        file_path = "data/预审查数据/Bidding_contents_2022-2025年度三峡电站9台机组检修密封加工制作重新招标招标文件印刷版.json"
+        file_path = "data/预审查数据/三峡左岸及电源电站中央空调系统管网及末端改造(发布稿)-table.json"
         Bidding_context = self.bm.json_read(file_path)
         return Bidding_context
     
@@ -106,6 +106,43 @@ class DocumentPreReview():
         if hit_num>=3: return True
         else: return False
 
+    def check_table(self):
+        ''' check the form to assess quailty'''
+        all_tables = self.Bidding_tables
+
+        tables_list = []
+        for partial_form in all_tables:
+            table_name = partial_form['table_name']
+            page_number = partial_form['page_numbers']
+            tables = partial_form["table"]
+
+            for table in tables:
+                if '须知' in table and '前附表' in table:
+                    pass
+
+            form_ = {'table_name':table_name, 'page_numbers':page_number, 'table':[]}
+
+
+
+            for table_index, table in enumerate(tables):
+                if '前附表' not in table_name:
+                    form_['table'] = tables
+                    tables_list.append(form_)
+                    break
+
+                regulation_number_index = table.index("条款号")
+                evaluation_factor_index = table.index("评审因素")
+                evaluation_criteria_index = table.index("评审标准")
+
+                
+                if '评分因素' in table and '评分标准' in table:
+                    regulation_number_index = table.index("条款号")
+                    evaluation_factor_index = table.index("评分因素")
+                    evaluation_criteria_index = table.index("评分标准")
+                    weights_index = table.index("权重")
+
+
+
 
     def get_table(self):
         ''' parse the Bidding_tables.json file to get the table data from it.
@@ -122,7 +159,7 @@ class DocumentPreReview():
         
         scrutinize_dict = {}
         scrutinize_page = 0
-        scrutinize_index = 0
+        scrutinize_index = -1
         scrutinize_Initial_title_len = 0  # 详审位置标记
 
         record_page = 0
@@ -143,10 +180,9 @@ class DocumentPreReview():
                         if table[0]: bidder_know[table[0]].append({"条款名称":table[1],"编列内容":table[2]})
                     except:
                         logger.error('该文件中的投标人须知前附表部分表格没有边框,只有中间部分表格存在边框,提取代码认为只有边框存在才被判定为表格内容')
-                
-            if '评标方法' in table_name:
-                table_name = table_name.strip().replace("\n","")
-            if table_name == "评标办法前附表":
+            
+            form_sign = re.findall('评\w+法前附表',table_name)
+            if form_sign:
                 table_page_num = page_number[0]
                 inital_data = tables[0]
                 # confirm data location
@@ -180,7 +216,8 @@ class DocumentPreReview():
                         weights_index = table.index("权重")
                         tag_sign = ''
                         scrutinize_index = tables.index(table)
-                if scrutinize_index:
+                        break
+                if scrutinize_index != -1:
                     for table in tables[scrutinize_index+1:]:
                         if table[regulation_number_index+1]: tag = table[regulation_number_index+1]
                         elif self._scrutinize_judge(table[regulation_number_index+2]): tag = table[regulation_number_index+2]
@@ -197,11 +234,12 @@ class DocumentPreReview():
                                         "评分标准":evaluation_criteria.strip().replace("\n",""),
                                         "权重":weights.strip().replace("\n","")}
                         scrutinize_dict[tag_sign].append(value)
+
                         if '报价' in tag_sign and '标准' in tag_sign:
                             scrutinize_dict = {key: value for key, value in scrutinize_dict.items() if value}
                             scrutinize_Initial_title_len = 0
                             break
-            elif scrutinize_page+1 == page_number[0] and '报价' not in tag_sign:
+            elif scrutinize_page+1 == page_number[0] and '报价' not in tag_sign and tag_sign:
                 difference_value = scrutinize_Initial_title_len - title_len
                 if scrutinize_Initial_title_len:
                     evaluation_factor_index -= difference_value
@@ -220,20 +258,20 @@ class DocumentPreReview():
                     if tag and self._scrutinize_judge(tag):
                         tag_sign = tag
                         if tag_sign not in scrutinize_dict: scrutinize_dict[tag_sign] = []
-                    try:
-                        evaluation_factor,evaluation_criteria,weights = table[evaluation_factor_index],table[evaluation_criteria_index],table[weights_index]
-                    except:
-                        print()
+                    evaluation_factor,evaluation_criteria,weights = table[evaluation_factor_index],table[evaluation_criteria_index],table[weights_index]
                     if not weights: value = {"评分因素":evaluation_factor.strip().replace("\n",""), "评分标准":evaluation_criteria.strip().replace("\n","")}
                     else: value = {"评分因素":evaluation_factor.strip().replace("\n",""),
                                     "评分标准":evaluation_criteria.strip().replace("\n",""),
                                     "权重":weights.strip().replace("\n","")}
-                    scrutinize_dict[tag_sign].append(value)
+                    try:
+                        scrutinize_dict[tag_sign].append(value)
+                    except:
+                        print()
                     if '报价' in tag_sign and '标准' in tag_sign:
                         scrutinize_dict = {key: value for key, value in scrutinize_dict.items() if value}
                         scrutinize_Initial_title_len = 0
                         break
-            elif scrutinize_page+2 == page_number[0] and '报价' not in tag_sign:
+            elif scrutinize_page+2 == page_number[0] and '报价' not in tag_sign and tag_sign:
                 difference_value = scrutinize_Initial_title_len - title_len
                 if scrutinize_Initial_title_len:
                     evaluation_factor_index -= difference_value