Blame view
examples/entropy.rb
346 Bytes
3e81fa06a
|
1 2 3 4 5 6 7 8 9 10 11 |
require 'rir' # Concatenates all lines from one file, without readme = File.open('README.markdown').readlines.collect { |l| l.chomp }.join(" ") # Creates the document with a string doc = RIR::Document.new readme # Outputs all the unique words of the document with their entropy scores p doc.words.collect { |w| "#{w} => #{doc.entropy w}" } |