diff --git a/sorter.rb b/sorter.rb index ffc9c6d..f2f6eb0 100755 --- a/sorter.rb +++ b/sorter.rb @@ -19,12 +19,17 @@ ############################################################################ require 'json' require 'pp' +require 'csv' -json = File.read('./bins.json') +#json = File.read('./bins.json') +csv = CSV.read('./bins.csv') text = File.read('tester.txt') -bins = JSON.parse(json) #Turn bins.json into a hash +#bins = JSON.parse(json) #Turn bins.json into a hash output = Hash.new #Creating the output storage object +bins = Hash.new +csv.each { |bin| bins[bin[0].to_sym] = bin[1..].compact } + #bin_counter expects: # bin - a hash with strings to search for # test - the document text to search through