This add-on is operated by Ikayzo Inc.
Shelter from profanity bombing
Table of Contents
Sometimes your content has to be family friendly, or safe for work. Adding Bomberman to your application is like putting a bomb shelter around your application. With this add-on you can tailor exactly which words and phrases you would like to filter based on your target demographic.
There are currently 3 different ways Bomberman can help shelter you from profanity your user entered content.
- Check if a piece of text contains profanity
- Replace profane words in a piece of text with ‘***’ or other another string of your choosing
- Wrap the profane words in closing and ending tags/characters to highlight them in a piece of text
Bomberman is accessible via an HTTP API and has supported client libraries for Ruby.
Provisioning the add-on
Bomberman can be attached to a Heroku application via the CLI:
A list of all plans available can be found here.
$ heroku addons:add bomberman -----> Adding bomberman to drunken-tyrion-4005... done, v18 (free)
Once Bomberman has been added a
BOMBERMAN_API_KEY setting will be available in the app configuration and will contain the API key for the. This can be confirmed using the
heroku config:get command.
$ heroku config:get BOMBERMAN_API_KEY 793687a6753581e75510d09bc221c8a6
After installing Bomberman the application is configured to fully integrate with the add-on.
After provisioning the add-on it’s necessary to locally replicate the config vars so your development environment can operate against the service.
Though less portable it’s also possible to set local environment variables using
Use Foreman to reliably configure and run the process formation specified in your app’s Procfile. Foreman reads configuration variables from an .env file. Use the following command to add the BOMBERMAN_API_KEY values retrieved from heroku config to
$ heroku config -s | grep BOMBERMAN_API_KEY >> .env $ more .env
Credentials and other sensitive configuration values should not be committed to source-control. In Git exclude the .env file with:
echo .env >> .gitignore.
Using with Rails 3.x
We developed a ruby client gem for making requests to the Bomberman API.
Ruby on Rails applications will need to add the following entry into their
Gemfile specifying the Bomberman client library.
Update application dependencies with bundler.
$ bundle install
Now create an initializer file
config/initializers/bomberman.rb with your
Bomberman.configure do |config| config.api_key = ENV['BOMBERMAN_API_KEY'] end
Assuming you have setup your local environment per previous section, you can now use Bomberman::Profanity functionality both locally and on Heroku.
Checking if text contains profanity
To check if a piece of text or corpus contains profanity use the
.profane?(corpus) method. This will return a boolean value as the result
non_profane_text = "The quick brown fox jumped over the lazy dog." Bomberman::Profanity.profane?(non_profane_text) #=> false profane_text = "The quick brown fox jumped over the F-BOMBing lazy dog." Bomberman::Profanity.profane?(profane_text) #=> true
Censoring profane words & phrases
If you would like to save or display text where the profane words (if any) are obfuscated the
.censor(corpus, replacement_text) method is what you are looking for.
non_profane_text = "The quick brown fox jumped over the lazy dog." Bomberman::Profanity.censor(non_profane_text, "####") #=> "The quick brown fox jumped over the lazy dog." profane_text = "The quick brown fox jumped over the F-BOMBing lazy dog." Bomberman::Profanity.censor(profane_text, "####") #=> "The quick brown fox jumped over the ### lazy dog."
replacement_text parameter is a string and optional.
"***" is suppled by default.
Highlighting profane words & phrases
Sometimes it is useful to leave the original profane word/phrase intact but wrap it in some sort of tag to make it stand out. This can be accomplished with the
.highlight(corpus, start_tag, end_tag) method.
non_profane_text = "The quick brown fox jumped over the lazy dog." BomberMan::Profanity.highlight(non_profane_text, "<blink>", "</blink>") #=> "The quick brown fox jumped over the lazy dog." profane_text = "The quick brown fox jumped over the F-BOMBing lazy dog." BomberMan::Profanity.highlight(profane_text, "<blink>", "</blink>") #=> "The quick brown fox jumped over the <blink>F-BOMBing</blink> lazy dog."
end_tag parameters are strings and optional. A pair of opening and closing
<strong> tags are used if none are provided.
Checking japanese text for profanity
Bomberman supports checking Japanese text for profanity. To do this pass an optional language argument with the value
:ja as the last parameter to any of the
non_profane_text = "èãããªãã¯ã®æ¥" Bomberman::Profanity.profane?(non_profane_text, :ja) #=> false
The Bomberman dashboard allows you to tailor your profanity shelter to your specific needs. From here you can choose what specific words or phrases you want to block or allow through.
The dashboard can be accessed via the CLI:
$ heroku addons:open bomberman Opening bomberman for drunken-tyrion-4005â¦
or by visiting the Heroku apps web interface and selecting the application. Select Bomberman from the Add-ons menu.
These are phrases that include one or more words that by themselves would be considered profane, but strung together they compose a phrase you would like to allow through your shelter. Allowed Phrases must contain more than one word (non whitespace characters separated by a space).
Just because a phrase does not include profanity does not mean that it isn’t offensive to your users. Here you can beef up your shelter with specific phrases your targeted demographic might not like to see in your content. Blocked Phrases must contain more than one word (non whitespace characters separated by a space).
Adds custom protection to your shelter just like Blocked Phrases but for single words (cannot contain whitespace).
Japanese blocked words
Bomberman support for the Japanese language allows you to add custom blocked words. Click on the “Japanese” button in the language toggle at the top of the page. From here you will be brought to a Japanese localized page where you can manage the blocked words for this language.
We are just starting out. If you experience trouble please contact us at firstname.lastname@example.org.
Migrating between plans
Application owners should carefully manage the migration timing to ensure proper application function during the migration process.
heroku addons:upgrade command to migrate to a new plan.
$ heroku addons:upgrade bomberman:f-bomb -----> Upgrading bomberman:newplan to drunken-tyrion-4005... done, v18 ($59/mo) Your plan has been updated to: bomberman:f-bomb
Removing the add-on
Bomberman can be removed via the CLI.
This will destroy all associated data and cannot be undone!
$ heroku addons:remove bomberman -----> Removing bomberman from drunken-tyrion-4005... done, v20 (free)
All Bomberman support and runtime issues should be submitted via email to email@example.com.