diff options
author | Patrick Simianer <p@simianer.de> | 2015-05-29 09:23:41 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2015-05-29 09:23:41 +0200 |
commit | 84618d64e3b763415a237cc244e6ad1a787e9cef (patch) | |
tree | 294896d42c1102f922541afa6d61990628f1e992 | |
parent | 79ffc2ecbe7fb47ceac1143f81f9d3311f02fcc6 (diff) |
feature_dict, convert_to_svmlight_format: stderr output
-rwxr-xr-x | convert_to_svmlight_format | 3 | ||||
-rwxr-xr-x | feature_dict | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/convert_to_svmlight_format b/convert_to_svmlight_format index 7e5c538..a9ce98f 100755 --- a/convert_to_svmlight_format +++ b/convert_to_svmlight_format @@ -5,10 +5,11 @@ require 'zipf' fd = Marshal.load ReadFile.read ARGV[0] d = fd.size +not_quiet = ARGV[1] train = [] l_i = 1 while line = STDIN.gets - puts l_i if l_i%1000==0 + STDERR.write "#{l_i}\n" if l_i%1000==0&¬_quiet s = [] line.split.each { |i| k,w = i.split '=', 2 diff --git a/feature_dict b/feature_dict index d0ebb7a..6849769 100755 --- a/feature_dict +++ b/feature_dict @@ -1,10 +1,11 @@ #!/usr/bin/env ruby +not_quiet = ARGV[1] n = 0 feature_dict = {} l_i = 1 while line = STDIN.gets - STDERR.write "#{l_i}\n" + STDERR.write "#{l_i}\n" if l_i%1000==0&¬_quiet line.split.each { |i| f, v = i.split('=', 2) if !feature_dict.has_key? f @@ -15,7 +16,7 @@ while line = STDIN.gets l_i += 1 end -f = File.new "fd.dump", 'w' +f = File.new ARGV[0], 'w' f.write Marshal.dump feature_dict f.close |