def get_common(T_path, data_path, r_way, h, ways, combine, model, v_way, T, r, R_los): datas = read_datas(data_path, r_way) datas = get_puredatas(datas) messages = add_tail(datas, h) f_name = str(h) + ways + combine + model + v_way + str(T) + str(r) + str( time.time()) + ".txt" out_f = R_out() out_f.set_path(T_path, f_name) out_f.trans_out() print(h, ways, combine, model, v_way, T, r) g_f = gformat() t_f = g_f.get_format(datas, h, ways, combine, model, v_way, T, r) f_trans = transer() borders_pre = f_trans.border2item(t_f) M_dealer = message_dealer() M_dealer.set_conlo(borders_pre) M_dealer.set_rlo(R_los) M_dealer.get_f1() M_dealer.set_dataM(messages) print("after") M_dealer.resplit("yes") M_dealer.reclus("yes") M_dealer.get_f1() out_f.back_out()
def cls_fun(self, messages, lo_s, lo_e): transpose = transer() t_dic = {} others = [] for message in messages: t_idom = transpose.byte2str(message[lo_s:lo_e]) if t_idom == "": others.append(message) continue if t_idom not in t_dic: t_dic[t_idom] = [] t_dic[t_idom].append(message) return t_dic, others
def split_by_ve(self, messages, h, combine, model, v_way, T=0, r=0, ways="g"): voter = voters() split_messages = voter.single_message_voter(messages, h, combine, model, v_way, T, r) converter = transer() return converter.listtoids(split_messages)
def ve_word(): word_dis = words_discover() word_redis = redis_deal() word_r = word_dis.infer_words_by_ve(["/home/wxw/data/modbusdata", "/home/wxw/data/modbus_github"], "single", 3, "yes", "abs", "loose", 0, 0) word_redis.insert_to_redis(ve_stra_str + 'word_rank_correct', word_r) word_pures = [word[0] for word in word_r] word_redis.insert_to_redis(ve_stra_str + 'word_pure_rank_correct', word_pures) word_transer = transer() modbus_w = modbus() word_t = word_transer.field_keys(modbus_w.fields) word_redis.insert_to_redis(ve_stra_str + 'word_true_correct', word_t) t_measure = Fields_measure(word_t, word_pures) t_cnt = t_measure.measure(1000) print(t_cnt) t_now = time.strftime("%Y-%m-%d %H:%m:%s", time.localtime(time.time())) words_logger = get_logger(log_path + '/word_log' + vote_pre + t_now, 'word_logger') words_logger.error(word_r)