Class: Bayes::PaulGraham::Corpus

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCorpus

Returns a new instance of Corpus.



203
204
205
206
# File 'lib/bayes.rb', line 203

def initialize
  super(0)
  @count = 0
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



202
203
204
# File 'lib/bayes.rb', line 202

def count
  @count
end

Instance Method Details

#<<(src) ⇒ Object



208
209
210
211
212
213
# File 'lib/bayes.rb', line 208

def <<(src)
  @count += 1
  src.each do |i|
    self[i] += 1
  end
end