Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

22b、2bc、sbc这些都无法通过配置匹配到空 #59

Open
OPGithub opened this issue May 16, 2024 · 5 comments
Open

22b、2bc、sbc这些都无法通过配置匹配到空 #59

OPGithub opened this issue May 16, 2024 · 5 comments

Comments

@OPGithub
Copy link

OPGithub commented May 16, 2024

这个ignoreRepeat(true)会出现22b,ignoreRepeat(false)会出现2b ,事实上我想匹配到的是空

final String text = "22b";
List<String> wordList = SensitiveWordBs.newInstance()
        .ignoreRepeat(true)
        .wordResultCondition(WordResultConditions.englishWordMatch())
        .init()
        .findAll(text);

这个englishWordMatch、以及alwaysTrue都会出现sb,事实上我想匹配到的是空

final String text = "sbc";
List<String> wordList = SensitiveWordBs.newInstance()
        .wordResultCondition(WordResultConditions.englishWordMatch())
        .init()
        .findAll(text);
@OPGithub OPGithub changed the title 当出现重复希望英文+数字重复混合的必须全词匹配,这个时候会出现问题 22b、2bc、sbc这些都无法通过配置匹配到空 May 16, 2024
@houbb
Copy link
Owner

houbb commented May 23, 2024

试下这个:

#45

@OPGithub
Copy link
Author

试下这个:

#45

这个会有问题,就是要找到所有的纯字母和数字的敏感词,一个个手动加入到白名单,有点怪,而且如果敏感词库更新了,多了个类似的敏感词,就会导致不可预知的异常

@OPGithub
Copy link
Author

期望能够设置,最长匹配连续的字母数字。比如abbcc 当中出现bc不会有问题,仅在 a bc d 这种情况会匹配到bc。从代码文字意义来说englishWordMatch 这个应该是需要符合这个规则的才对

@houbb
Copy link
Owner

houbb commented May 28, 2024 via email

@OPGithub
Copy link
Author

OPGithub commented May 28, 2024

因为中文词是连续的,所以匹配最长不太可行。 主流的做法就是先最短匹配,结果出来可以做二次筛选或者警告之类的。 发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: guaxi @.> 发送时间: 2024年5月28日 11:09 收件人: houbb/sensitive-word @.> 抄送: 老马啸西风 @.>, Comment @.> 主题: Re: [houbb/sensitive-word] 22b、2bc、sbc这些都无法通过配置匹配到空 (Issue #59) 期望能够设置,最长匹配连续的字母数字。比如abbcc 当中出现bc不会有问题,仅在 a bc d 这种情况会匹配到bc。从代码文字意义来说englishWordMatch 这个应该是需要符合这个规则的才对 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

但是WordResultConditions.englishWordMatch配置这个之后,sbc这是一个单词,不应该匹配到sb才对。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants