BadWordDetector
Swear word detector
Ruleset is not complete. If you want to use it in your project, please edit lib/config/rules.yaml
or use your own ruleset!
Installation
Add this line to your application's Gemfile:
gem 'bad_word_detector'
And then execute:
$ bundle
Or install it yourself as:
$ gem install bad_word_detector
Usage
Detects #uck
, F|_|__C_K
and other variations of hidden swear words in text.
Usage:
finder = BadWordDetector.new
finder.find("What the #uck")
it will return BadWord object
Transformation rules is defined in form:
{"#" => {"symbol"=>"f", "weight" => 2}} # weight is optional
Or in file conf/rules.yaml
List of swear words is located in conf/library.yaml
Whitelist of english words in conf/whitelist.yaml
You can also set own rules:
finder = BadWordDetector.new rules, library, whitelist
Or you can use string filenames for YAML files of same format:
finder = BadWordDetector.new 'my_rules.yaml', 'my_library.yaml', 'my_whitelist.yaml'
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request