(self,para)
Return:
                wft:树的根节点
                words_frequency:从文件中读取的词频列表
                template_tag_dir: 模板号跟模板的对应关系，其中模板是字符串
Return:
                wft:树的根节点
                words_frequency:从文件中读取的词频列表
                template_tag_dir: 模板号跟模板的对应关系，其中模板是字符串
Return : wft : 树的根节点 words_frequency : 从文件中读取的词频列表 template_tag_dir : 模板号跟模板的对应关系，其中模板是字符串
def __init__(self,para):
        '''
            Return:
                wft:树的根节点
                words_frequency:从文件中读取的词频列表
                template_tag_dir: 模板号跟模板的对应关系，其中模板是字符串
        '''
        template_path = para['template_path']
        match_model = para['match_model']
        #print('&&&&&&&&&&&&&&&&&&&&&&&&&&&&init___template_path:', template_path)
        #print('****************************init___match_model', match_model)
        fre_word_path = para['fre_word_path']
        wft = ft_tree.WordsFrequencyTree()
        tag = 1 #模板号从1 开始
        with open(template_path) as IN:
            for line in IN:
                self.log_once_list.append(['',line.strip().split()])
                #从template文件中读取tag
                #tag = line.strip().split()[0]
                #template = ' '.join(line.strip().split()[1:])
                template = line.strip()
                self.template_tag_dir[template] = tag
                self.tag_template_dir[tag] = template
                tag += 1
        # print(self.tag_template_dir)
        # print('logoncelistlogoncelistlogoncelistlogoncelist-----------------')
        # print(self.log_once_list)


        if match_model == 4:
            #print('4444444444444444444444444444')
            wft.paths = []
            wft._nodes = []
            for words in self.log_once_list:
                wft._init_tree([''])
            wft.auto_temp1(self.log_once_list, para, rebuild=1)
            self.tree = wft
        else:
            #print('not4444444444444444444444444444')
            with open(fre_word_path) as IN:
                for line in IN:
                    self.words_frequency.append(line.strip())
            wft.paths = []
            wft._nodes = []
            for words in self.log_once_list:
                wft._init_tree([''])
            wft.auto_temp(self.log_once_list, self.words_frequency, para, rebuild=1)
            self.tree = wft
def __init__ ( self , para ) : template_path = para [ 'template_path' ] match_model = para [ 'match_model' ] #print('&&&&&&&&&&&&&&&&&&&&&&&&&&&&init___template_path:', template_path) #print('****************************init___match_model', match_model) fre_word_path = para [ 'fre_word_path' ] wft = ft_tree . WordsFrequencyTree ( ) tag = 1 #模板号从1 开始 with open ( template_path ) as IN : for line in IN : self . log_once_list . append ( [ '' , line . strip ( ) . split ( ) ] ) #从template文件中读取tag #tag = line.strip().split()[0] #template = ' '.join(line.strip().split()[1:]) template = line . strip ( ) self . template_tag_dir [ template ] = tag self . tag_template_dir [ tag ] = template tag += 1 # print(self.tag_template_dir) # print('logoncelistlogoncelistlogoncelistlogoncelist-----------------') # print(self.log_once_list) if match_model == 4 : #print('4444444444444444444444444444') wft . paths = [ ] wft . _nodes = [ ] for words in self . log_once_list : wft . _init_tree ( [ '' ] ) wft . auto_temp1 ( self . log_once_list , para , rebuild = 1 ) self . tree = wft else : #print('not4444444444444444444444444444') with open ( fre_word_path ) as IN : for line in IN : self . words_frequency . append ( line . strip ( ) ) wft . paths = [ ] wft . _nodes = [ ] for words in self . log_once_list : wft . _init_tree ( [ '' ] ) wft . auto_temp ( self . log_once_list , self . words_frequency , para , rebuild = 1 ) self . tree = wft