March 8, 2019

Good Ruby gem for "obscenity filtering?"

Justin Jackson @mijustin

Use case: In, we'd like to warn users when they have explicit words in their show notes, so Apple doesn't reject their RSS feed.

Basically, a list of words that if found returns a warning to the user.

I see some really old ones on GitHub (~6 years old) but nothing new.

@csallen what do you use?

Also, this Jeff Atwood article has me worried about implementation


  1. 1

    I've used swearer with some success. -

  2. 1

    Your granny rides massive throbbing purple meat rods in prison.

    None of those words were profanities.

    Profanity filters are clbuttically bad ideas. It takes a human to detect profanity.

    1. 2

      Profanity filters should not be trusted 100% of the way, however, they can give a pretty good estimate depending on what you have trained them with.

      That being said, the best solution to that problem is pairing the filters with user reports, like you say, adding a human intermediary but also utilising that result to keep on making the filter better.

      ML can't (and most likely will never) achieve 100% certainty for detecting said profanities, but pair it with a human and it can get those extra points needed for near perfection.

  3. 1

    I played around with hate speech recognition a few weeks ago and found this:

    Probably a sledgehammer to crack a nut but maybe it helps.

  4. 1

    I have seen this gem used in stuff:

  5. 1

    I use something like it for my own content processing, but written in PHP.

    What it does is to use "bad words" list as an array, then break the checked content into an array as well using punctuation and spaces. With that, we check each word (or part of it) for bad word in array + bad word in the array - 1 character. For exact matches, you get an error, for a word that had character removed, you get a warning. This gives you a pretty good way of getting an idea what's what. This is only a base for the more advanced tool, but good enough to get you started.

    All can be done in a few loops and using native tools, so there is no overhead.

  6. 1

    Interesting, I don't use anything like that for IH.

  7. 1

    This comment was deleted 9 months ago.

    1. 1

      This comment was deleted 9 months ago.