本文整理汇总了Python中feature_extractor.FeatureExtractor.extract_ngram_list方法的典型用法代码示例。如果您正苦于以下问题:Python FeatureExtractor.extract_ngram_list方法的具体用法?Python FeatureExtractor.extract_ngram_list怎么用?Python FeatureExtractor.extract_ngram_list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类feature_extractor.FeatureExtractor
的用法示例。
在下文中一共展示了FeatureExtractor.extract_ngram_list方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_database_from_file
# 需要导入模块: from feature_extractor import FeatureExtractor [as 别名]
# 或者: from feature_extractor.FeatureExtractor import extract_ngram_list [as 别名]
def update_database_from_file(self,
file_name,
asm_file_path,
gdl_file_path,
compiler=None,
optimization_level=None):
file_name += '_' + compiler + '_' + optimization_level
parser = IDAFileParser()
extractor = FeatureExtractor()
db_constructor = DatabaseConstructor()
# Update file_name table
db_constructor.insert_file_name(file_name)
# Update instruction_sequence table
instruction_list = parser.extract_instruction(asm_file_path)
db_constructor.insert_instruction_sequence(file_name, instruction_list)
# Update instruction_code_block table
code_block_list = parser.extract_code_block(asm_file_path)
db_constructor.insert_code_block(file_name, code_block_list)
# Update opcode_variety table
opcode_list = parser.extract_opcode(asm_file_path)
db_constructor.append_opcode_variety(opcode_list)
# Update bigram_variety table
bigram_list = extractor.extract_ngram_list(opcode_list, 2)
db_constructor.append_bigram_variety(bigram_list)
# Update trigram_variety table
trigram_list = extractor.extract_ngram_list(opcode_list, 3)
db_constructor.append_trigram_variety(trigram_list)
# Update api table
api_list = parser.extract_api(gdl_file_path)
db_constructor.insert_api(file_name, api_list)
# Update api_variety table
db_constructor.append_api_variety(api_list)
if compiler is not None:
# Update compiler_information table
db_constructor.insert_compiler_information(file_name, compiler)
if optimization_level is not None:
# Update optimization_level_information table
db_constructor.insert_optimization_level_information(file_name, optimization_level)