diff options
author | Patrick Simianer <p@simianer.de> | 2016-07-05 11:01:46 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2016-07-05 11:01:46 +0200 |
commit | 2b1d7f881c19c4d4b5afae194e02d3300c7675d0 (patch) | |
tree | 5a06ee7de98640a39244b57bb369697176b44ebf /avg_weights | |
parent | 69949dda35c3ea21d8e926e5f0a596a0a0f61c6a (diff) |
mv
Diffstat (limited to 'avg_weights')
-rwxr-xr-x | avg_weights | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/avg_weights b/avg_weights deleted file mode 100755 index 36b051a..0000000 --- a/avg_weights +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env ruby - -require 'zipf' -require 'trollop' -require 'zlib' - -conf = Trollop::options do - opt :weights_files, "a number of weights files: name value", :required => true - opt :filter, "Filter if key does not appear in every file.", :type => :bool, :default => false -end - -h = {} -ARGV.each { |fn| - f = ReadFile.new fn - while line = f.gets - k, v = line.split - v = v.to_f - if h.has_key? k - h[k] << v - else - h[k] = [v] - end - end - f.close -} - -n = ARGV.size.to_f - -h.each_pair { |k,w| - next if conf[:filter] and w.size < n - puts "#{k} #{w.inject(:+)/n}" -} - |