class Classiphier::Data

Public Class Methods

new() click to toggle source
# File lib/classiphier/data.rb, line 3
def initialize
  self[:data]  = {}
  self.default = 0
end

Public Instance Methods

perform!() click to toggle source
# File lib/classiphier/data.rb, line 17
def perform!
  self[:count] += 1
end
train(sentence) click to toggle source
# File lib/classiphier/data.rb, line 8
def train(sentence)
  perform!
  sentence.words.each do |word|
    self[:data][word] ||= 0
    self[:data][word] += 1
    self[:words] += 1
  end
end