예제 #1
0
 def apply_mapping(self):
     self.msgs = mapping_dict_msg(pad_msg=self.msgs, dict_msg=self.dict_msg)
     self.added_code = mapping_dict_code(pad_code=self.added_code,
                                         dict_code=self.dict_code)
     self.removed_code = mapping_dict_code(pad_code=self.removed_code,
                                           dict_code=self.dict_code)
     self.msgs = convert_msg_to_label(pad_msg=self.msgs,
                                      dict_msg=self.dict_msg)
예제 #2
0
        dictionary = pickle.load(open(params.dictionary_data, 'rb'))
        dict_msg, dict_code = dictionary

        pad_msg = padding_message(data=msgs, max_length=params.msg_length)
        added_code, removed_code = clean_and_reformat_code(codes)
        pad_added_code = padding_commit_code(data=added_code,
                                             max_file=params.code_file,
                                             max_line=params.code_line,
                                             max_length=params.code_length)
        pad_removed_code = padding_commit_code(data=removed_code,
                                               max_file=params.code_file,
                                               max_line=params.code_line,
                                               max_length=params.code_length)

        pad_msg = mapping_dict_msg(pad_msg=pad_msg, dict_msg=dict_msg)
        pad_added_code = mapping_dict_code(pad_code=pad_added_code,
                                           dict_code=dict_code)
        pad_removed_code = mapping_dict_code(pad_code=pad_removed_code,
                                             dict_code=dict_code)
        pad_msg_labels = convert_msg_to_label(pad_msg=pad_msg,
                                              dict_msg=dict_msg)

        data = (pad_added_code, pad_removed_code, pad_msg_labels, dict_msg,
                dict_code)
        params.batch_size = 1
        extracted_cc2ftr(data=data, params=params)
        print(
            '--------------------------------------------------------------------------------'
        )
        print(
            '--------------------------Finish the extracting process-------------------------'
        )