diff options
author | Patrick Simianer <pks@pks.rocks> | 2020-08-12 07:32:06 +0200 |
---|---|---|
committer | Patrick Simianer <pks@pks.rocks> | 2020-08-12 07:32:06 +0200 |
commit | 64e8bdba930479249b8dfbc4b5d4b659a95433f0 (patch) | |
tree | e26969b03d8380ee8d2cbc1328f851772006133c /joint-set | |
parent | 74e20e00dfbffdcf117778049e47acd79e320110 (diff) | |
parent | 4732fb3be94ba3f88b18295cf1c00e8c616eec73 (diff) |
Merge branch 'master' of ssh://github.com/pks/nlp_scripts
Diffstat (limited to 'joint-set')
-rwxr-xr-x | joint-set | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/joint-set b/joint-set new file mode 100755 index 0000000..b9b9b22 --- /dev/null +++ b/joint-set @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby + +require 'set' +require 'zipf' + +n = ARGV.pop.to_i + +all = [] +all_sets = [] +ARGV.each { |file| + fp = ReadFile.new file + a = [] + s = Set.new + while line = fp.gets + a << line + s << line + end + all << a + all_sets << s +} + +joint_set = all_sets.pop +all_sets.each { |set| + joint_set &= set +} + +joint_set.each { |i| + puts i +} + |