Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Gab-bler (noun) - rapid, unintelligible talk

branch: master

Release 0.1.0

latest commit 13294e1b77
Michael Dvorkin authored December 21, 2011
Octocat-spinner-32 lib Release 0.1.0 December 21, 2011
Octocat-spinner-32 sample Initial implementation December 21, 2011
Octocat-spinner-32 spec Initial implementation December 21, 2011
Octocat-spinner-32 .gitignore Initial implementation December 21, 2011
Octocat-spinner-32 CHANGELOG Initial implementation December 21, 2011
Octocat-spinner-32 Gemfile Initial implementation December 21, 2011
Octocat-spinner-32 Gemfile.lock Initial implementation December 21, 2011
Octocat-spinner-32 LICENSE Initial implementation December 21, 2011
Octocat-spinner-32 README.md Release 0.1.0 December 21, 2011
Octocat-spinner-32 Rakefile Initial implementation December 21, 2011
Octocat-spinner-32 gabbler.gemspec Initial implementation December 21, 2011
README.md

Gabbler

Gabbler is a Ruby library that generates pseudo-random phrases. Any coherent text file with adequate number of sentences could serve as Gabbler's training set. Once trained, Gabbler produces pseudo-random sentences based on the original text.

Installation

# Installing as Ruby gem
$ gem install gabbler

# Cloning the repository
$ git clone git://github.com/michaeldv/gabbler.git

Usage Example

$ cat > holmes.rb
require "gabbler"                         # Require the gem.
gabbler = Gabbler.new                     # Create new Gabbler instance.
story = File.read("./sample/holmes.txt")  # Read first chapter of 'A study in Scarlet'.
gabbler.learn(story)                      # Make Gabbler learn about Sherlock Holmes.
10.times { puts gabbler.sentence }        # Generate ten pseudo-rando sentences.
gabbler.unlearn!                          # Forget Sherlock Holmes.
gabbler.learn(story.reverse)              # Teach Gabbler about semloH kcolrehS.
puts gabbler.sentence                     # .dezama eB
^D
$ ruby holmes.rb
This is very piquant.
You perceive that the resulting mixture has the appearance of pure water.
How on earth did you know that?
If you like, we shall drive round together after luncheon.
Now we have the Sherlock Holmes' test, and there will no longer be any difficulty.    
I followed, however, with many other officers who were in the enemy's country.    
This was a lofty chamber, lined and littered with countless bottles.
My companion smiled an enigmatical smile.
Did you never ask him what he was going in for?
So is the microscopic examination for blood corpuscles.    
senil esoht no repap a trats thgim uoY.

Running Specs

$ gem install rspec           # RSpec 2.x is the requirement.
$ rake spec                   # Run the entire spec suite.

Note on Patches/Pull Requests

  • Fork the project on Github.
  • Make your feature addition or bug fix.
  • Add specs for it, making sure $ rake spec is all green.
  • Commit, do not mess with Rakefile, version, or history.
  • Send me a pull request.

License

Copyright (c) 2011 Michael Dvorkin
twitter.com/mid
%w(mike dvorkin.net) * "@" || %w(mike fatfreecrm.com) * "@"
Released under the MIT license. See LICENSE file for details.
Something went wrong with that request. Please try again.