web-mech / badwords

A javascript filter for badwords
MIT License
618 stars 325 forks source link

Persian bad words not getting filtered #75

Open pcm0nk opened 4 years ago

pcm0nk commented 4 years ago

Hi, Im trying to use this library to filter persian bad words Steps to reproduce : 1- Adding persian bad words var newBadWords = ['شمبلیله', 'کرونا', 'فقط']; filter.addWords(...newBadWords); 2- using clean function to clean the bad word filter.clean("شمبلیله فقط یک کرونا است") Actual Result It shows everything and not filtering any of the words givin, Altho if I add one english word it will clean it if its in the list Expected Result It should remove the words added and replace them with *

Is there anything Im missing ? Thanks for any help

rodrigoreis22 commented 4 years ago

I'm having the same problem for a customer with Tamil language.. from reading their docs it looks like you must provide your own RegEx for this to work:

var filter = new Filter({ replaceRegex:  /[A-Za-z0-9가-힣_]/g }); 
//multilingual support for word filtering
NovawareTechTeam commented 3 years ago

If you haven't already, maybe you could add them to lib/lang.json.