Put another nickel in the swearjar. Simple profanity detection with content analysis.
Ruby
Latest commit 864f807 Dec 23, 2016 @m1foley m1foley Bump version to 1.2.0
Permalink
Failed to load latest commit information.
lib Bump version to 1.2.0 Dec 23, 2016
spec Add acceptance test: the Seven Dirty Words routine Feb 16, 2016
.gitignore
.travis.yml Add Travis CI config Jan 31, 2016
CHANGELOG.md
Gemfile
README.md Improve usage instructions in README Feb 13, 2016
Rakefile
swearjar.gemspec Fix reference in gemspec Feb 14, 2016

README.md

Swearjar

Simple profanity detection with content analysis.

Installation

gem install swearjar

Usage

require "swearjar"

sj = Swearjar.default

sj.profane?("jim henson has a massive hard on he is gonna use to fuck everybody")
# => true

sj.scorecard("jim henson has a massive hard on he is gonna use to fuck everybody")
# => {:sexual => 2}

sj.censor("jim henson has a massive hard on he is gonna use to fuck everybody")
# => "jim henson has a massive **** ** he is gonna use to **** everybody"

To load from a custom config file, you can do the following:

# For an example see lib/config/en.yml
sj = Swearjar.new("my_swears.yml")