def read_token_simplify_file(level): fname = os.path.join(idatapath, 'token_simplify_%s.txt' % level) fname = fileabspath.filePathAdj().get_file_path(fname) #lines = open(fname, 'r').readlines() lines = read_idata(fname) d_dict = {} for line in lines: line_sp = line.split('\t') d_dict[line_sp[0].strip()] = line_sp[1].strip() return d_dict
def get_level_igs(level): level_igs = [] fname = os.path.join(idatapath, 'token_controller_%s.txt' % level) fname = fileabspath.filePathAdj().get_file_path(fname) #lines = open(fname, 'r').readlines() lines = read_idata(fname) if not lines: return level_igs for line in lines[1:]: line = line.strip('\n') ls = line.split('\t') if ls[3].strip() == 'None': continue if 1: #str(level) == ls[0].strip(): level_igs.append(ls[1:]) return level_igs
def get_level_igs_user(level, user): level_igs = [] conf_path = cfgObj.get_config('PageAnalysis', 'rule_file_path') fname = os.path.join(conf_path, user, 'token_controller_%s.txt' % level) #fname = os.path.join(idatapath, 'token_controller_%s.txt' %level) fname = fileabspath.filePathAdj().get_file_path(fname) #lines = open(fname, 'r').readlines() lines = read_idata(fname) if not lines: return level_igs for line in lines[1:]: line = line.strip('\n') ls = line.split('\t') if ls[3].strip() == 'None': continue if 1: #str(level) == ls[0].strip(): level_igs.append(ls[1:]) return level_igs
def read_rule_selection_file(level): fname = os.path.join(idatapath, 'rule_igs_%s.txt' % level) fname = fileabspath.filePathAdj().get_file_path(fname) #lines = open(fname, 'r').readlines() lines = read_idata(fname) d_dict = {} for line in lines: if not line.strip(): continue lsp = line.strip('\n').split('\t') d_dict[lsp[0].strip()] = [] for l in lsp[1:]: if not l.strip(): continue d_dict[lsp[0].strip()].append(l.strip()) return d_dict
import os, sys import shelve import common.baseobj as bobj import common.getconfig as getconfig import common.datastore as datastore import common.get_doc_data as get_doc_data import common.filePathAdj as fileabspath import common.decfile as decfile #cfgfname = fileabspath.filePathAdj().get_file_path('/var/www/cgi-bin/tasinfosieveresearch/tirsrc2/tirintf2/modules/PDF_APP/config.ini') #cfgfname = fileabspath.filePathAdj().get_file_path('/var/www/cgi-bin/tasfundamentals/tfmsrc/tfmintf2/config_fundamentals.ini') cfgfname = fileabspath.filePathAdj().get_file_path( '/var/www/cgi-bin/tasfundamentals/tfmsrc/tfmsrcpdf/src/config.ini') cfgObj = getconfig.getconfig(cfgfname) #idatapath = cfgObj.get_config('PageAnalysis', 'input') #ipath, self.opath, self.isdb, self.isenc = bobj.BaseObj().get_project_info() #self.isdb = int(self.isdb) #self.isenc = int(self.isenc) #ipath = '/var/www/html/INFOSIEVE_PROJECTS/AssetsDemo/data/output/' #self.opath = '/var/www/html/INFOSIEVE_PROJECTS/AssetsDemo/data/output/' #self.isdb = 1 #self.isenc = 1 class common_func: def __init__(self, ipath, opath, isdb, isenc): self.ipath = ipath self.opath = opath self.isdb = isdb self.isenc = isenc