-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bypassed by plural profanities #12
Comments
@raymondjavaxx This is a totally awesome package and exactly what I was looking for! However, I did notice this issue and that you can also get "compound" curses, so to speak, to pass. For example, "sh-tfu-k" is not on your default list, and while adding each additional word is of course possible with the way you have it set up, I wonder if you would be open to me submitting a PR that solves both of these issues without the need for adding additional specific words? I have a working solution locally and I would love to show it to you / discuss it. A couple of examples: swearjar.profane('no f-cks given') // true
swearjar.censor('no f-cks given') // no ***** given
swearjar.censor('sh-ttyf-cks') // *********** Let me know! Thanks. |
@no-stack-dub-sack the compound stuff is tricky without significantly altering (and slowing down) the scanning algorithm. @fasterthan plurals should be an easy fix, I'll see if I can get to it. |
@fasterthan actually this could be covered by #11 so I'll hold off for now. |
@loctn Yeah, upon a closer look, and deeper testing with the solution I had, I did run into some tricky situations. Namely censoring common words that contained swears. For instance, This was the edit I made to the scan: function (text, callback) {
var word, key, match;
var regex = /\w+/g
while (match = regex.exec(text)) {
word = match[0];
key = word.toLowerCase();
if (key in this._badWords && Array.isArray(this._badWords[key])) {
if (callback(word, match.index, this._badWords[key]) === false) {
break;
}
} else {
/******* added else statement to catch compound bad words and plurals such as
"no fu*ks given" and "fu*ksh*t" without having to add each to default list */
for (let badWord in this._badWords) {
if (key.search(badWord) > -1) {
if (callback(key, match.index, this._badWords[badWord]) === false) {
break;
}
}
}
}
}
}, Again, may not be ideal, but working well for my use-case. |
Simply adding an 's' to the end of a profanity defeats the filter.
For example, "No fucks given" is not censored.
The text was updated successfully, but these errors were encountered: