updated sorter to accept csv input instead of json
parent
32c08b75d7
commit
ed996122a4
|
@ -19,12 +19,17 @@
|
||||||
############################################################################
|
############################################################################
|
||||||
require 'json'
|
require 'json'
|
||||||
require 'pp'
|
require 'pp'
|
||||||
|
require 'csv'
|
||||||
|
|
||||||
json = File.read('./bins.json')
|
#json = File.read('./bins.json')
|
||||||
|
csv = CSV.read('./bins.csv')
|
||||||
text = File.read('tester.txt')
|
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
|
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_counter expects:
|
||||||
# bin - a hash with strings to search for
|
# bin - a hash with strings to search for
|
||||||
# test - the document text to search through
|
# test - the document text to search through
|
||||||
|
|
Loading…
Reference in New Issue