//增加敏感词
private void addWord(String lineTxt) {
TireNode tempNode = rootNode;
for (int i = 0;i < ();i++) {
Character c = (i);
TireNode node = (c);
if (node == null) {
node = new TireNode();
(c, node);
}
tempNode = node;
if (i == () - 1) {
(true);
}
}
}
public String filter(String text) {
if ((text)) {
return text;
}
StringBuilder result = new StringBuilder();
String replacement = "***"; //打码
TireNode tempNode = rootNode; //从根节点出发
int begin = 0; //从句子的第一个字符开始
int position = 0; //指向当前位置
while (position < ()) {
char c = (position);
if (isSymbol(c)) {
if (tempNode == rootNode) {
(c);
begin++;
}
position++;
continue;
}
tempNode = (c);
if (tempNode == null) {
((begin));
position = begin + 1;
begin = position;
tempNode = rootNode;
} else if (()) {
//发现敏感词
(replacement);
position = position + 1;
begin = position;
tempNode = rootNode;
} else {
position++;
}
}
((begin));
return ();
}