From aaa6be0e31ffd77f5a524c370746dd615272c87a Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 5 Jul 2017 07:54:14 +0200 Subject: overlap --- overlap | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 overlap diff --git a/overlap b/overlap new file mode 100755 index 0000000..81f9c4b --- /dev/null +++ b/overlap @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby + +require 'zipf' + +a = {} +a.default = 0 +ReadFile.readlines_strip(ARGV[0]).map { |segment| a[segment] += 1 } +b = {} +b.default = 0 +ReadFile.readlines_strip(ARGV[1]).map { |segment| b[segment] += 1 } + +overlap = 0 +a.each_key { |seg| + puts b[seg] + overlap = overlap+b[seg] +} + +puts "---" +puts overlap + -- cgit v1.2.3