Giter Site home page Giter Site logo

Comments (2)

toolgood avatar toolgood commented on August 20, 2024

可以尝试 我的项目 https://github.com/toolgood/ToolGood.Words
敏感词过滤支持C#,JAVA,GO,JS, Python3

from sensitivewd-filter.

mkyuangithub avatar mkyuangithub commented on August 20, 2024

存在bug: 当有连续且重复的字作为敏感词时,检验不出来

问题是作者在循环时变量污染导致,需要修改doFilter方法和isContains方法:

  1. 在 public static final String doFilter(final String src)方法中,我把错误的三行都注释掉了,见"变量污染问题注释掉"这样的字眼
    k = i;
    //cpcurrc = currc; // 当前字符的拷贝-变量污染问题注释掉
    for (; ++k < length;) {
    int temp = charConvert(chs[k]);
    //if (temp == cpcurrc)-变量污染问题注释掉
    //continue;-变量污染问题注释掉
    if (stopwdSet != null && stopwdSet.contains(temp))
  2. 在public static final boolean isContains方法中,我把错误的三行都注释掉了,见"变量污染问题注释掉"这样的字眼
    // cpcurrc = currc;-变量污染问题注释掉
    for (; ++k < length;) {
    int temp = charConvert(chs[k]);
    // if (temp == cpcurrc)-变量污染问题注释掉
    // continue;-变量污染问题注释掉
    if (stopwdSet != null && stopwdSet.contains(temp))
    运行结果如下,这样就解决了“连续重复词”不能过滤的bug了。

解析问题: 习大&_大 flg
解析字数 : 9
解析时间 : 29092636ns
解析时间 : 29ms


是否包含敏感词: true
解析时间 : 28377ns
解析时间 : 0ms

from sensitivewd-filter.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.