#!/usr/bin/env ruby # -*- ruby -*- # # Input: # Output of analyze_mail with lines like this: # \t # # Output: # CSV with emails as columns and sorted dates as rows. # # Note: # This sucks, but it works well enough for now. I'm going to get back # to watching football. # require 'utils.rb' def main(argv) dates2emails2counts = get_dates2emails2counts argv sorted = dates2emails2counts.sort {|a,b| a[0] <=> b[0]} # Gather total counts of emails and note the dates that should be filtered out emails2totals = {} min_date_amount = 500 dates2exclude = {} sorted.each do |date,emails2counts| total = 0 emails2counts.each do |email,count| cnt = emails2totals[email] cnt = 0 if !cnt total += cnt cnt += count emails2totals[email] = cnt end if total < min_date_amount dates2exclude[date] = true end end # Output the first row as emails, so long as that email has enough entries min_email_amount = 100 print 'DATE' emails2totals.each do |email,total| next if total