def log_likelihoods(text, classnames=nil)
      classnames ||= @classnames
      result = Hash.new 0

      TextHash.new(text).each { |word, count|
        probs = get_word_probs(word, classnames)
        classnames.each { |k|
          # Choose a really small probability if the word has never been seen before in class k
          result[k] += Math.log(probs[k] > 0 ? (probs[k] * count) : Float::EPSILON)
        }
      }

      # add the prior
      doc_counts = doc_count_totals.select { |k,v| classnames.include? k }.map { |k,v| v }

      doc_count_total = (doc_counts.inject(0){ |x,y| x+y } + classnames.length).to_f

      classnames.each { |k|
        result[k] += Math.log((@storage.get_doc_count(k) + 1).to_f / doc_count_total)
      }

      result
    end
def log_likelihoods(text, classnames=nil)
      classnames ||= @classnames
      result = Hash.new 0

      TextHash.new(text).each { |word, count|
        probs = get_word_probs(word, classnames)
        classnames.each { |k|
          # Choose a really small probability if the word has never been seen before in class k
          result[k] += Math.log(probs[k] > 0 ? (probs[k] * count) : Float::EPSILON)
        }
      }

      # add the prior
      doc_counts = doc_count_totals.select { |k,v| classnames.include? k }.map { |k,v| v }

      doc_count_total = (doc_counts.inject(0){ |x,y| x+y } + classnames.length).to_f

      classnames.each { |k|
        result[k] += Math.log((@storage.get_doc_count(k) + 1).to_f / doc_count_total)
      }

      result
    end
Classes is an array of classes to look at