本文整理汇总了Java中org.apache.hadoop.tools.rumen.anonymization.WordListAnonymizerUtility类的典型用法代码示例。如果您正苦于以下问题:Java WordListAnonymizerUtility类的具体用法?Java WordListAnonymizerUtility怎么用?Java WordListAnonymizerUtility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WordListAnonymizerUtility类属于org.apache.hadoop.tools.rumen.anonymization包,在下文中一共展示了WordListAnonymizerUtility类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: anonymize
import org.apache.hadoop.tools.rumen.anonymization.WordListAnonymizerUtility; //导入依赖的package包/类
private static String anonymize(String data, WordList wordList) {
if (data == null) {
return null;
}
if (WordListAnonymizerUtility.needsAnonymization(data)) {
String suffix = "";
String coreData = data;
// check and extract suffix
if (WordListAnonymizerUtility.hasSuffix(data, KNOWN_SUFFIXES)) {
// check if the data ends with a known suffix
String[] split =
WordListAnonymizerUtility.extractSuffix(data, KNOWN_SUFFIXES);
suffix = split[1];
coreData = split[0];
}
// check if the data is known content
//TODO [Chunking] Do this for sub-strings of data
String anonymizedData = coreData;
if (!WordListAnonymizerUtility.isKnownData(coreData)) {
if (!wordList.contains(coreData)) {
wordList.add(coreData);
}
anonymizedData = wordList.getName() + wordList.indexOf(coreData);
}
return anonymizedData + suffix;
} else {
return data;
}
}