# File lib/rir/document.rb, line 78 def entropy(s) en = 0.0 counts = self.count_words s.split.each do |w| p_wi = counts[w].to_f/@words.count.to_f en += p_wi*Math.log2(p_wi) end en *= -1 en end