FrostCo / AdvancedProfanityFilter

A browser extension to filter profanity from webpages
GNU General Public License v3.0
164 stars 27 forks source link

Filter swear words with asterisk #580

Open ZGGrOydHRyl opened 1 month ago

ZGGrOydHRyl commented 1 month ago

:bug: Description

AdvancedProfanityFilter is not filtering swear words with asterisk unless I manually add them to the list. I can't add all swear words with asterisk manually. AdvancedProfanityFilter should filter it or provide a setting to filter it.

:twisted_rightwards_arrows: Steps To Reproduce

Swear words with asterisk (example: "t*sting") isn't being filtered. Is there a setting I can enable to filter all swear words with asterisk?

Screenshot of Reddit post: image

:heavy_check_mark: Expected behavior

swear words with asterisk should be filtered.

:camera: Screenshots

Here is a example from reddit post where AdvancedProfanityFilter isn't filtering swear words.

image

:computer: Details

richardfrost commented 1 month ago

@ZGGrOydHRyl Thanks for the suggestion. I'll look into this more, but my first thought is this will be difficult to accomplish in a reliable way. Currently the filter does support matching separators (- & _) in a word, like t-e-s-t-i-n-g or test-ing, but still requires all the letters to be there so we know it is the word we are looking for, just with characters to separate it (commonly used in an attempt to bypass filtering on a site).

ZGGrOydHRyl commented 1 month ago

@richardfrost For a quick resolution or a workaround can you not just import a list of swear words with asterisks? Or let users import it through extension? I'm sure we can find a list of swear words with asterisk online.

Allowing us to import a list would be nice. I can't type all of it but I can find a list and import it if the extension allows.

richardfrost commented 1 month ago

@ZGGrOydHRyl Yes, that is something you could do. When adding a lot (100+ words) it can cause the filter to slow down on slower devices, but most shouldn't have much of an issue.

To import a list of words, open the Options page and go to the "Words" tab, and click the Bulk Editor button. In the bottom-left corner you can paste a list (one word/phrase per line) and then click the Bulk Add Words button. That will then add them to the table above, where you can make any modifications if you'd like. Once it all looks good, just click the Save button.

Before using the bulk word editor I'd recommend saving a backup of your settings (Options page > Config tab > Export).

ZGGrOydHRyl commented 1 month ago

@richardfrost I prefer to filter all words which has asterisk in it and replace it with something else like "". How can I achieve this?

Update: I came up with the following regex and it is working.

[a-z]+\*+[a-z]*|[a-z]*\*+[a-z]+

richardfrost commented 1 month ago

@ZGGrOydHRyl, you should be able to accomplish that by adding a new word:

image

image

ZGGrOydHRyl commented 1 month ago

@richardfrost That worked thank you!

richardfrost commented 1 month ago

@ZGGrOydHRyl You're welcome! Let me know if you run into trouble with it, its possible it might need to be adjusted a bit, but hopefully it works well for you!