(self, logs, para, rebuild=0)
Args:
            pids: pids of all syslog
            lines: 分词后的集合
            words_frequency: 词频列表
            rebuild: 0 模板提取， 1 fttree重建

        Returns:
def auto_temp1(self, logs, para, rebuild=0):
        """

        Args:
            pids: pids of all syslog
            lines: 分词后的集合
            words_frequency: 词频列表
            rebuild: 0 模板提取， 1 fttree重建

        Returns:

        """
        leaf_num = para['leaf_num']
        CUTTING_PERCENT = 0
        # print ('rebuild',rebuild)
        if rebuild == 0:
            CUTTING_PERCEN = para['CUTTING_PERCENT']


        assert logs != []
        # assert words_frequency != []
        for log in logs:
            pid, words = log
            words = list(words)#过滤掉重复的单词set
            print(words)
            words_index = {}
            words_count = {}
            for word in words:
            #     if word in words_frequency:
            #         words_index[word] = float(words_frequency.index(word))
                #统计重复的单词
                if word not in words_count:
                    words_count[word]=0
                words_count[word]+=1
            for k, v in words_index.items():
                print(k, v)

            for word in words_count:
                if words_count[word]>1:
                    print('words_count[word]>1')
                    cur_word=word
                    for i in range(words_count[word]-1):
                        cur_word= cur_word+' '+word
                    words_index[cur_word] = words_index[word]
                    # print cur_word
                    # print word
                    words_index.pop(word)

            #======================anzhaocipin paixulog
            # words = [x[0] for x in sorted(words_index.items(), key=lambda x: x[1])]
            words_len = len(words)
            words = ' '.join(words).split()
            # print('----------------1words-----------------')
            # print(words)

            # print len(words)
            for index, value in enumerate(words):
                no_cutting = 0 #0一切正常，按照leafnum剪枝，1不剪枝
                if rebuild == 1: #表示matchTemplate中调用函数重新建树
                    no_cutting = 1 #如果重新建树，则所有的节点都不减枝
                elif index<=float(len(words))*CUTTING_PERCENT:
                    no_cutting = 1
                if index == words_len - 1:
                    # self.tree_list[pid].insert_node(words[:index], value, 0, leaf_num, no_cutting, rebuild)# 暂时去掉模板子集的限制，即不检测最后一个结点了，即只保留长模板
                    self.tree_list[pid].insert_node(words[:index], value, para, 1, no_cutting, rebuild) #检测最后一个节点！ 保留短模板
                else:
                    self.tree_list[pid].insert_node(words[:index], value, para, 0, no_cutting, rebuild)
def auto_temp1 ( self , logs , para , rebuild = 0 ) : leaf_num = para [ 'leaf_num' ] CUTTING_PERCENT = 0 # print ('rebuild',rebuild) if rebuild == 0 : CUTTING_PERCEN = para [ 'CUTTING_PERCENT' ] assert logs != [ ] # assert words_frequency != [] for log in logs : pid , words = log words = list ( words ) #过滤掉重复的单词set print ( words ) words_index = { } words_count = { } for word in words : #     if word in words_frequency: #         words_index[word] = float(words_frequency.index(word)) #统计重复的单词 if word not in words_count : words_count [ word ] = 0 words_count [ word ] += 1 for k , v in words_index . items ( ) : print ( k , v ) for word in words_count : if words_count [ word ] > 1 : print ( 'words_count[word]>1' ) cur_word = word for i in range ( words_count [ word ] - 1 ) : cur_word = cur_word + ' ' + word words_index [ cur_word ] = words_index [ word ] # print cur_word # print word words_index . pop ( word ) #======================anzhaocipin paixulog # words = [x[0] for x in sorted(words_index.items(), key=lambda x: x[1])] words_len = len ( words ) words = ' ' . join ( words ) . split ( ) # print('----------------1words-----------------') # print(words) # print len(words) for index , value in enumerate ( words ) : no_cutting = 0 #0一切正常，按照leafnum剪枝，1不剪枝 if rebuild == 1 : #表示matchTemplate中调用函数重新建树 no_cutting = 1 #如果重新建树，则所有的节点都不减枝 elif index <= float ( len ( words ) ) * CUTTING_PERCENT : no_cutting = 1 if index == words_len - 1 : # self.tree_list[pid].insert_node(words[:index], value, 0, leaf_num, no_cutting, rebuild)# 暂时去掉模板子集的限制，即不检测最后一个结点了，即只保留长模板 self . tree_list [ pid ] . insert_node ( words [ : index ] , value , para , 1 , no_cutting , rebuild ) #检测最后一个节点！ 保留短模板 else : self . tree_list [ pid ] . insert_node ( words [ : index ] , value , para , 0 , no_cutting , rebuild )