问题描述
对于一个从孩子们那里得到输入的网站,我们需要过滤他们在网站上输入他们的评论(运行PHP)时使用的任何淘气/坏话。
评论是一个免费的领域,用户可以输入他们想要的任何意见。我能想到的解决方案是有一个单词列表,如
BLACKLIST:bad,bad,word,woord,craap,craaaap,(我们可以填写所有黑名单)
然后,当表单被保存时,我们可以查看列表,如果有任何单词存在,那么我们不会允许保存评论。
但是这个方法的问题在于,他们可以通过给单词添加字母来避开EG:shiiiiit
让我知道你认为是为这些单词创建一些过滤器的最好方法。
你永远无法过滤每一个排列。也许最可行的解决方案是过滤显而易见的,并实施报告滥用机制,以便有人可以手动查看(和拒绝)怀疑评论。
For a website that takes input from kids we need to filter any naughty / bad words that they use when they enter their comments in the website (running PHP).
The comments are a free field and users can enter whatever comments they want. The solution I can think of is to have a words list likeBLACKLIST: bad,bad,word,woord,craap,craaaap, (We can fill this with all the blacklisted words).
Then when the form is saved we can look at the list and if any of the words are present then we will not allow the comment to be saved.
BUT the prolem with this method is that they can get around by adding letters to the words to make it skip the filter EG: shiiiiit
Let me know what you think is the best way to create some filter for these words.
You're never going to be able to filter every permutation. Perhaps the most feasible solution is to filter the obvious, and implement a "Report Abuse" mechanism so someone can manually look over (and reject) suspect comments.
这篇关于内容上的黑名单过滤消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!