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?
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?