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

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.

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

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

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)