snipe / banbuilder

Composer package for censoring profanity in web applications, forums, etc.
http://www.banbuilder.com
324 stars 98 forks source link

Request: How do you build your dictionaries? #31

Open gebeer opened 8 years ago

gebeer commented 8 years ago

I have an app where users can add banwords through a form and I would like to add these to a custom dictionary file. The way the dictionaries are provided atm as PHP code makes it quite difficult to append terms to them programmatically. A format like CSV would be much easier to extend.

You could move the array_push($badwords,... into the readBadWords method and get CSV or JSON dictionary contents via file_get_contents and then parse them?

EDIT: Thinking more about it, you might have implemented it as is for performance reasons because parsing dictionaries into arrays will take extra time?

buchin commented 7 years ago

I'm using newline separated text file. It's easier to add/remove word.