Is there any PHP script to stop the bad words in user generated content?

by 10 replies
13
I want a script which can filter or stop the badwords in content posted by the users in my classifieds script. Since there are so many bad words that are there in english and it is tougher to build the list of bad words if some ready made script is available to do that job that will help me well. If any one know such script please help me getting that.
#programming #bad #content #generated #php #script #stop #user #words
  • you could use preg_replace. pass it an array of "bad" words to replace
  • Here's a list: Bad words list (458 words)

    Pretty easy to write a simple strip or replace function.
    • [1] reply
    • I did use this list of badwords. But still I could see a lot of bad words used by the users. I want a comprehensive list of these words. Any one who finds such list please give me a message. Thankyou.
  • I like to do jobs like this in PERL. CPAN is so robust and powerful, simple tasks like bad word filtration only take one line of PERL to write.
    • [1] reply
    • In addition to using this language that lwbco discussed, this can easily be done by setting up a Neural Network trained on badwords so that any in the array is replaced by something like , "Smurf". Using a NN means that once it's trained on the current list of common bad words, it'll make assessments (similar to a spam filter in E-mail) about future bad words and permutation there of.

      Might as well save you some work in the future, right?
  • neural networks in perl are really the way to go
    • [1] reply
    • I personally like to use neurals in Ruby but that's just me.
      • [1] reply
  • o yah i assumed this server would have been on windows, so you have to install perl either way.

    i guess for simplicity sake he could just wire it up to a webservice that makes lists of block decisions available by a HTTP interface? then all you have to do is curl the list, decode the data, check it against your posts, and publish away. PERL's CGI capabilities would be ideally suited for this.
    • [ 2 ] Thanks
  • use function, array variable. list all the badwords and disable all their value

Next Topics on Trending Feed