Conditional Frequency Distribution
Install
gem sources -a http://rubygems.org
sudo gem install frequency_distribution
How To Use
require 'rubygems'
require 'frequency_distribution'
happy_text = %w{when happy things happen it makes me happy}
sad_text = %w{when sad things happen it makes me sad}
conditions = {:happy => happy_text, :sad => sad_text}
cfd = FrequencyDistribution.new(conditions, "happy", "sad")
results = cfd.proces
results[:happy]["happy"]
#=> 2
cfd.to_tabulation
#=> happy sad
# sad 0 2
# happy 2 0
Note on Patches/Pull Requests
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright
Copyright © 2010 Red Davis. See LICENSE for details.