内容上的单词黑名单以过滤消息 [英] Blacklist of words on content to filter message

查看:18
本文介绍了内容上的单词黑名单以过滤消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于接受儿童输入的网站,我们需要过滤他们在网站(运行 PHP)中输入评论时使用的任何顽皮/坏词.

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).

评论是一个自由字段,用户可以输入他们想要的任何评论.我能想到的解决方案是有一个单词列表黑名单:bad,bad,word,wood,craap,craaaap,(我们可以用所有列入黑名单的词来填充).

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 like BLACKLIST: 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.

但是这种方法的问题是他们可以通过在单词上添加字母来绕过过滤器 EG:shiiiiit

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.

这篇关于内容上的单词黑名单以过滤消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆