Project

sauber

0.0
No commit activity in last 3 years
No release in over 3 years
A tiny profanity filter that use blacklist, whitelist and sanitization rules to clean up profanity in text.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.9
>= 0
~> 10.0
>= 0
 Project Readme

Sauber

A tiny profanity filter.

Gem Version Build Status Code Climate Test Coverage

Installation

Add this line to your application's Gemfile:

gem 'sauber'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sauber

Usage

Sauber.configure do |config|
  config.blacklist = ["bad", "crime", "war"]
  config.whitelist = ["peace"]
  config.replacement = :stars
end

Blacklist

Words or phrases that you would like to remove.

config.whitelist accepts the following values:

  • An array with words
  • A string representing a path to a yml file

Whitelist

Phrases that contain a word from the blacklist that you don't wish to remove.

config.blacklist accepts the following values:

  • An array with words
  • A string representing a path to a yml file

Replacement

config.replacement accepts the following values:

  • :stars : Replaces profane words with '*' up to the word's length

Basic Usage

Sauber.clean("simple text")
=> "simple text"

Sauber.clean("text with shit")
=> "text with ****"

Contributing

  1. Fork it ( https://github.com/[my-github-username]/sauber/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request