Babbler is a Ruby gem that will make short nonsense phrases for you. The phrases nominally consist of an adjective followed by a noun, though the format can be configured. The words in the phrase are common English words.
Add this line to your application's Gemfile:
gem 'babbler'
And then execute:
$ bundle
Or install it yourself as:
$ gem install babbler
To configure Babbler, put the following code in your applications initialization logic (eg. in the config/initializers in a Rails app)
Babbler.configure do |config|
...
end
The following example lists all of the available configuration options, with the default values shown:
Babbler.configure do |config|
# Use a different format for the resulting phrase
# phrase, e.g. with a value of 'nn' you might get 'prosecutor dog'
config.format = 'an'
# Choose a different word list. Options:
# :original - the original word list in Babbler
# :safer_words_1 - the original list with potentially awkward words removed
# :california_words - words 2nd graders in California are expected to know
config.word_list = :original
end
To get a random babble, type:
Babbler.babble
To always be able to get a specific babble, pass an integer in:
Note: This is not guaranteed to be the same result over major versions
Babbler.babble(42)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Add tests
- Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request