問題描述
對于接受兒童輸入的網站,我們需要過濾他們在網站(運行 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.
這篇關于內容上的單詞黑名單以過濾消息的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!