blob: e4621f513cacd2d8e010890c56ce36e59ff7bac7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/usr/bin/env ruby
require 'zipf'
require 'trollop'
def main
cfg = Trollop::options do
opt :f, "f files", :type => :string, :required => true
opt :e, "e files", :type => :string, :required => true
end
f_files = cfg[:f].split
e_files = cfg[:e].split
h = {}
f_files.each_with_index { |fn,i|
fa = ReadFile.readlines_strip fn
ea = ReadFile.readlines_strip e_files[i]
fa.each_with_index { |fw,j|
if h.has_key? fw
h[fw] << ea[j]
else
h[fw] = [ea[j]]
end
}
}
h.each_pair { |f,ea|
puts "#{f}\t#{ea.first}"
}
end
main
|