Report abuse


			
def train texts
  model = Hash.new(0)
  texts.each do |text|
    File.new(text).read.downcase.scan(/[a-z]+/).each do |word|
      model[word] += 1
    end
  end
  return model
end

NWORDS = train ['holmes.txt','dictionaries/2of4brif.txt']