Exemple #1
0
 def act_extract(self):
     if self.filepath_in is None or not os.path.exists(self.filepath_in):
         self.act_open()
     # initialize
     self.combobox.clear()
     self.combobox.addItem('原件')
     self.combobox.addItem(r'提取的文件')
     self.combobox.setCurrentIndex(1)
     #
     extract = Extract(self.filepath_in)
     extract.process(output_filepath=self.filepath_extract)
     #db['project_info'].set_db(extract.extract_project_infos())
     self.refresh_left_preview(self.filepath_extract)
Exemple #2
0
extract_filename = 'simohua-extract.docx'
extract_filepath = os.path.join(os.getcwd(), extract_filename)

output_filename = 'output.docx'
output_filepath = os.path.join(os.getcwd(), output_filename)

tmp_dir1 = os.path.join(os.getcwd(), 'tmp\\split')
tmp_dir2 = os.path.join(os.getcwd(), 'tmp\\split-processed')

from misc import mkdir

if __name__ == "__main__":
    #
    extract = Extract(input_filepath)
    extract.process()  #output_filepath=extract_filepath)
    db['project_info'].set_db(extract.extract_project_infos())
    #
    mkdir(tmp_dir1)
    split = Split(input_filepath=extract_filepath)
    sections = split.process()
    #
    db['finance'].filtering(need_years=3)
    db['human'].select_people(name_list=['总经理姓名', '联系人姓名', '项目经理人姓名'])
    db['projects_done'].filtering(project_types=['水利'], need_years=3)
    db['projects_being'].filtering(project_types=['水利'])
    #
    mkdir(tmp_dir2)
    for section in sections:
        fillin = FillIn(os.path.join(tmp_dir1, section + '.docx'))
        fillin.process(os.path.join(tmp_dir2, section + '.docx'))