diff options
author | Patrick Simianer <p@simianer.de> | 2014-06-14 16:46:27 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-06-14 16:46:27 +0200 |
commit | 26c490f404731d053a6205719b6246502c07b449 (patch) | |
tree | 3aa721098f1251dfbf2249ecd2736434c13b1d48 /overlapping_rules/rules_cross_product.rb |
init
Diffstat (limited to 'overlapping_rules/rules_cross_product.rb')
-rwxr-xr-x | overlapping_rules/rules_cross_product.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/overlapping_rules/rules_cross_product.rb b/overlapping_rules/rules_cross_product.rb new file mode 100755 index 0000000..649a94c --- /dev/null +++ b/overlapping_rules/rules_cross_product.rb @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby + +require_relative './util.rb' + + +STDOUT.sync = true +approx_count = 7430933/192 + +i = 0 +prev_id = nil +accumulate = [] +read_rules_from_file2(STDIN, 'stdin') { |id,r| + i += 1 + if id != prev_id + if prev_id + accumulate.sort_by! { |i| i.id }#.uniq { |i| i.id } + accumulate.each_with_index { |a,j| + accumulate[j+1..accumulate.size].each_with_index { |b,k| + STDOUT.write "#{a.id}+#{b.id}\t#{a.to_s} <<<>>> #{b.to_s}\n" + } + } + accumulate.clear + end + prev_id = id + end + accumulate << r + STDERR.write "reporter:status:cross product ##{i} #{((i*100.0)/approx_count).round 2}%\n" +} + |