Net Text Censoring with Custom List

Any service that allows user-generated content brings with it a risk of content that can negatively impact your actual userbase’s…

Net Text Censoring with Custom List
Photo by Markus Spiske / Unsplash

any service that allows user-generated content brings with it a risk of content that can negatively impact your actual userbase’s experience.

there’s multiple ways you can moderate content. The ideal way would be use a content moderator service like Azure Content Moderator that uses AI to rate the content with a racy-score, giving you the ability to fine tune moderation based on your specific use-case. it can act as middleware between your insert call and automatically reject or accept posts. While not too expensive, its still a paid service.

when I was working with user-generated content, I decided I would allow the users to post whatever they like. however, when user content is fetched from the API, I added custom middleware that censors only the bad words from within a whole text and replaces it with asterisks.

the downside is that your censoring is only as good as the list you are filtering on. But the upside is that you still get the relevant part of the content while also protecting your userbase from unpleaseant language.

this was done quite some time ago and I can’t remember if I wrote this censor class myself or if I improved on it from some other source or if I copied all of it.

the list you can find here. I have compiled it by combining various resources, containing multiple languages — with a few additions of my own.