updated sorter to accept csv input instead of json

batch
Jeff Yates 2020-07-15 13:41:06 -04:00
parent 32c08b75d7
commit ed996122a4
1 changed files with 7 additions and 2 deletions

View File

@ -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