Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Put another nickel in the swearjar. Simple profanity detection with content analysis.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 swearjar.gemspec
README.rdoc

Swearjar

Simple profanity detection with content analysis.

Installation

gem install swearjar

Usage

require 'swearjar'

Swearjar.default.profane?('jim henson has a massive hard on he is gonna use to fuck everybody')
<< true

Swearjar.default.scorecard('jim henson has a massive hard on he is gonna use to fuck everybody')
<< {:sexual => 2}

Swearjar.default.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 yaml file, you can do the following

sj = Swearjar.new
sj.load_file('my_yaml.yml')

The YAML file can have two sections, `simple` and `regex`. For an example, see `lib/config/en.yml`.

Something went wrong with that request. Please try again.