def one_conf((conf, v)): def print_conf(conf, values, is_exists=False): ars_list = '#'.join([v.strip() for v in values]).replace(",", "0x32") \ if conf.method != "none" and conf.name != cst.label_name else "" print ','.join( map(str, [ conf.name, conf.method, conf.filter_threds if conf.filter_threds else "", conf.status, ars_list if not is_exists else conf.ars ])) return ','.join( map(str, [ conf.name, conf.method, conf.filter_threds if conf.filter_threds else "", conf.status, ars_list if not is_exists else conf.ars ])) if len(conf.ars) > 0: print "conf.ars already exists", conf.ars return print_conf(conf, [], True) key, value, frac = cst.parse_method( conf.method) # number freq 5 key, value, frac if key != "none": data_method = globals().get("process_{key}".format(**{"key": key})) rs = data_method(conf, value, frac, v) else: rs = [] return print_conf(conf, rs)
def read_conf(self): with codecs.open(self.config, 'r', 'utf8') as f: for n, l in enumerate(f.readlines()): if not l.startswith("#"): # 过掉注释 n += 1 print l cf = Conf(*l.split(",")) cf.arrs_list = gen_cates(cst.parse_method(cf.method)[0], cf.ars) self.fea_conf[cf.name] = cf self.fea_number_dict[cf.name] = n self.num_fea_dict = {self.fea_number_dict[x]: x for x in self.fea_number_dict} self.fea_number_value_list = {x: list() for x in self.fea_number_dict}
def read_conf(self): with codecs.open(self.config, 'r', 'utf8') as f: for n, l in enumerate(f.readlines()): if not l.startswith("#"): # 过掉注释 n += 1 cf = Conf(*l.split(",")) cf.method_arr_list = gen_arr_list_by_method_name(cst.parse_method(cf.method)[0], cf.args) self.name_conf_dict[cf.name] = cf self.name_id_dict[cf.name] = n self.id_name_dict = {self.name_id_dict[x]: x for x in self.name_id_dict} # 初始化特征的value list self.name_values_dict = {x: list() for x in self.name_id_dict}
def read_conf(self): with codecs.open(self.config, 'r', 'utf8') as f: for n, l in enumerate(f.readlines()): if not l.startswith("#"): # 过掉注释 n += 1 print l cf = Conf(*l.split(",")) cf.arrs_list = gen_cates( cst.parse_method(cf.method)[0], cf.ars) self.fea_conf[cf.name] = cf self.fea_number_dict[cf.name] = n self.num_fea_dict = { self.fea_number_dict[x]: x for x in self.fea_number_dict } self.fea_number_value_list = {x: list() for x in self.fea_number_dict}
def one_conf(conf): def print_conf(conf, values): with codecs.open(FEAS_RECONSTRUCT_FILE, 'a', 'utf8') as f: f.write( ','.join(map(str, [conf.name, conf.method, "#".join(conf.filter_threds) if conf.filter_threds else "",conf.status, '#'.join([v.strip() for v in values]).replace(",", "0x32")])) + '\n') print(','.join(map(str, [conf.name, conf.method, conf.status,"#".join(conf.filter_threds) if conf.filter_threds else "", '#'.join([v.strip() for v in values]).replace(",", "0x32")]))) if conf.method == "none" or conf.name == cst.LABEL: print_conf(conf, []) return key, value, frac = cst.parse_method(conf.method) data_method = globals().get("process_{key}".format(**{"key": key})) rs = data_method(conf, value,frac) print_conf(conf, rs)
def normal(fc, fea_value, fea): return FEA.__getattribute__(cst.parse_method(fc.method)[0])(fc.name, fea_value)
def pre_cal(self): # precalculate self.arrs_list = gen_cates(cst.parse_method(self.method)[0], self.ars)
def pre_cal(self): # precalculate self.method_arr_list = gen_arr_list_by_method_name(cst.parse_method(self.method)[0], self.args)