Open HydrogenMacro opened 1 month ago
Unless this actually becomes a huge issue, having a profanity filter is really wasteful.
I personally believe that an ounce of prevention is worth a pound of cure
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.
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.
If this is only for creating users, the username can't be that long and therefore less compute needed.
Ah yea, though this was for chatting or smth
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.