内容上的单词黑名单以过滤消息

Blacklist of words on content to filter message(内容上的单词黑名单以过滤消息)
本文介绍了内容上的单词黑名单以过滤消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

对于接受儿童输入的网站,我们需要过滤他们在网站(运行 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.

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

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Subtract time in PHP(在 PHP 中减去时间)
Limit execution time of an function or command PHP(限制函数或命令 PHP 的执行时间)
How to sum N number of time (HH:MM Format)?(如何求和 N 次(HH:MM 格式)?)
How to get current time in milliseconds in PHP?(如何在 PHP 中以毫秒为单位获取当前时间?)
How to check if time is between two times in PHP(如何检查时间是否在 PHP 中的两次之间)
Convert number of minutes into hours amp; minutes using PHP(将分钟数转换为小时数分钟使用 PHP)