0.05
No commit activity in last 3 years
No release in over 3 years
Put another nickel in the swearjar. Simple profanity detection with content analysis. Fork of Joshua Hull's swearjar with some additional functionality..
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.8.7
~> 1.3.0

Runtime

~> 0.0.11
 Project Readme

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"

The censor mask * can be overridden:

sj.censor("damn", "X")
# => "XXXX"

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")