Infinite-Chess / infinitechess.org

Infinite Chess Web Server
https://www.infinitechess.org
GNU Affero General Public License v3.0
172 stars 40 forks source link

Better profanity filter #21

Open HydrogenMacro opened 1 month ago

HydrogenMacro commented 1 month ago

Currently, the profanity filter is just a very short array of hard coded profanities. As well as being very susceptible to strategies like leetspeak, it is just not a formal way of filtering. My recommendation would be to use a library like this.

Nul-led commented 1 month ago

Unless this actually becomes a huge issue, having a profanity filter is really wasteful.

HydrogenMacro commented 1 month ago

I personally believe that an ounce of prevention is worth a pound of cure

Naviary2 commented 1 month ago

I also think this would be nice. Perhaps if it's easy to implement and the library isn't too big. But it's true there isn't a lot of need for this now.

Nul-led commented 1 month ago

The issue with profanity filters is that its hard to actually make it efficient. A naive implementation could iterate through the entire message, split it into substrings at each space and concat them back together until you have all permutations (excluding those which would be illogical like the first and last if the segment length is > 3 etc). They would then go through a filterlist of an arbitrary size. So as you can see, the amount of comparisons scales exponentially with the length of the message. Especially for "established" players with a low risk of profanity this is a huge waste of compute.

Heinrich-XIAO commented 1 month ago

If this is only for creating users, the username can't be that long and therefore less compute needed.

Nul-led commented 1 month ago

Ah yea, though this was for chatting or smth