package com.tourism.webadmin.utils;

import com.github.houbb.sensitive.word.api.IWordContext;
import com.github.houbb.sensitive.word.api.IWordReplace;
import com.github.houbb.sensitive.word.api.IWordResult;

/**
 * SerbiaWordReplace 类。
 * <p>
 * 描述：自定义敏感词替换策略
 *
 * @author huangwenwen
 * @date 2024/12/20
 */


public class SensitiveWordReplace implements IWordReplace {

    @Override
    public void replace(StringBuilder stringBuilder, char[] chars, IWordResult iWordResult, IWordContext iWordContext) {

//        String sensitiveWord = InnerWordCharUtils.getString(chars, iWordResult);
//        log.info("敏感词替换：{}",sensitiveWord);
//        //自定义策略
//        if ("你妈的".equals(sensitiveWord)){
//            stringBuilder.append("我爱你");
//        }else {
//            //其他的敏感字默认使用*代替
//            stringBuilder.append("*");
//        }
    }
}
