snipe / banbuilder

Composer package for censoring profanity in web applications, forums, etc.
http://www.banbuilder.com
324 stars 98 forks source link

Banning correct words, such as classroom #101

Open jagermesh opened 4 years ago

jagermesh commented 4 years ago
[orig] => this is our classroom
[clean] => this is our cl***room
lukepass commented 3 years ago

I have the same problem, is there a way to match whole words only? Thanks.

lukepass commented 3 years ago

I saw that you can pass a second argument to censorString and it will match whole words only:

public function censorString($string, $fullWords = false) // <-- defaults to false, you can put true to match whole words
jagermesh commented 3 years ago

Yeah, but this will start showing other words which are in 99% cases must be hidden. For example f**k must be considered as bad either as part of other word or as separate word, so regardless of the $fullWords true or false.

harpreetsb commented 3 years ago

same problem with word asshole if we set fullwords to true, word classroom is passed but then word asshole is also passed.

rob4226 commented 3 years ago

I would still set fullwords to true then add asshole to the dictionary so it will be filtered as a fullword.