def find_lenbyaccuone(self, datas, lengths): t_lener = words_base() t_dataone, t_datatwo = t_lener.get_lengthinfo(datas) acc_big = 0 data_nums = {} data_smalls = {} for i in range(len(t_dataone)): diff = abs(t_dataone[i] - lengths[i]) if diff not in data_nums: data_nums[diff] = 1 else: data_nums[diff] = data_nums[diff] + 1 acc_small = 0 for i in range(len(t_datatwo)): diff = abs(t_datatwo[i] - lengths[i]) if diff not in data_smalls: data_smalls[diff] = 1 else: data_smalls[diff] = data_smalls[diff] + 1 for key in data_nums: if acc_small < data_nums[key]: acc_small = data_nums[key] for key in data_smalls: if acc_big < data_smalls[key]: acc_big = data_smalls[key] if ((acc_small / len(t_dataone)) > self.lengthThreshold or (acc_big / len(t_dataone)) > self.lengthThreshold): return 1 else: return 0
def findserienum(self, datas, t_series): t_lener = words_base() t_dataone, t_datatwo = t_lener.get_seidinfo(datas) j_one = base_analyzer.pearson(t_dataone, t_series) j_two = base_analyzer.pearson(t_datatwo, t_series) j_final = max(j_one, j_two) return j_final
def find_len(self, datas, lens): t_lener = words_base() t_dataone, t_datatwo = t_lener.get_lengthinfo(datas) p_one = self.pearson(t_dataone, lens) p_two = self.pearson(t_datatwo, lens) if (p_one > self.lengthThreshold or p_two > self.lengthThreshold): return 1 else: return 0
def find_lenbyaccu(self, datas, lengths): t_lener = words_base() t_messages = [] t_dataone, t_datatwo = t_lener.get_lengthinfo(datas) acc_big = 0 for i in range(len(t_dataone)): if (abs((t_dataone[i] - lengths[i])) <= 1): acc_big = acc_big + 1 acc_small = 0 for i in range(len(t_datatwo)): if (abs((t_datatwo[i] - lengths[i])) <= 1): acc_small = acc_small + 1 if ((acc_small / len(t_dataone)) > self.lengthThreshold or (acc_big / len(t_dataone)) > self.lengthThreshold): return 1 else: return 0