Class: Bayes::PlainBayes::Corpus

Inherits:
Hash
  • Object
show all
Defined in:
lib/bayes.rb

Instance Method Summary collapse

Constructor Details

#initializeCorpus

Returns a new instance of Corpus.



172
173
174
# File 'lib/bayes.rb', line 172

def initialize
	super(0.0)
end

Instance Method Details

#<<(src) ⇒ Object



176
177
178
179
180
181
# File 'lib/bayes.rb', line 176

def <<(src)
	s = src.size.to_f
	src.each do |i|
		self[i] += 1/s
	end
end