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 /min_max | |
parent | 69949dda35c3ea21d8e926e5f0a596a0a0f61c6a (diff) |
mv
Diffstat (limited to 'min_max')
-rwxr-xr-x | min_max | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/min_max b/min_max deleted file mode 100755 index 1dbfd40..0000000 --- a/min_max +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/ruby - -require 'zipf' -require 'trollop' - -conf = Trollop::options do - opt :min, "minimum #tokens", :type => :int, :default => 1 - opt :max, "maximum #tokens", :type => :int, :default => 80, :short => '-n' - opt :in_f, "input 'French' file", :type => :string, :required => true - opt :in_e, "input 'English' file", :type => :string, :required => true - opt :out_f, "output 'French' file", :type => :string, :required => true - opt :out_e, "output 'English' file", :type => :string, :required => true - opt :out_id, "output line Nos", :type => :string, :required => true -end - - -files = {} -files[:f_file] = ReadFile.new conf[:in_f] -files[:e_file] = ReadFile.new conf[:in_e] -files[:f_out_file] = WriteFile.new conf[:out_f] -files[:e_out_file] = WriteFile.new conf[:out_e] -files[:id_out_file] = WriteFile.new conf[:out_id] -i = 0 -while f_line = files[:f_file].gets - e_line = files[:e_file].gets - f_line.strip! - e_line.strip! - a = f_line.split - b = e_line.split - if a.size >= conf[:min] and a.size <= conf[:max] and \ - b.size >= conf[:min] and b.size <= conf[:max] - files[:f_out_file].write "#{f_line}\n" - files[:e_out_file].write "#{e_line}\n" - files[:id_out_file].write "#{i}\n" - end - i+=1 -end - -files.values.each{ |f| f.close } - |