敏感数据识别
- opendlp.sensitive_analyze.table_analyzer.analyze(csv_table_path, regex_pattern_file=None, thresholds=None)[source]
表格敏感数据分析,识别出每一列数据所属敏感数据类型,如果不是敏感数据则为”OTHER”
- Parameters:
csv_table_path – 数据表文件路径,csv文件
regex_pattern_file – 自定义类型的识别正则表达式文件,json文件
thresholds – 敏感数据识别判断阈值,一列中某个敏感数据类型的占比达到阈值后则认为是此列数据是该敏感数据类型
- Returns:
敏感数据识别结果字典,键为列名,值为字典。值字典中”success”是否识别成功,”type”表示敏感数据类型,”fraction”表示该列中type类型的占比。 eg: {“qq”: {“success”: True, “type”: “OTHER”, “fraction”: “9/10”}, “pwd”: {“success”: True, “type”: “PASSWORD”, “fraction”: “10/10”}}
- class opendlp.sensitive_analyze.analyzer_engine.AnalyzerEngine(pattern_file: Optional[str] = '')[source]
敏感数据分析引擎
- analyze(texts: List[str], thresholds)[source]
对字符串列表中的数据进行敏感数据分析
- Parameters:
texts – 字符串列表
thresholds – 敏感数据识别判断阈值,一列中某个敏感数据类型的占比达到阈值后则认为是此列数据是该敏感数据类型
- Returns:
字符串列表中每一个字符串的敏感数据类型