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 /add_seg | |
parent | 69949dda35c3ea21d8e926e5f0a596a0a0f61c6a (diff) |
mv
Diffstat (limited to 'add_seg')
-rwxr-xr-x | add_seg | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/add_seg b/add_seg deleted file mode 100755 index e5db580..0000000 --- a/add_seg +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env ruby - -require 'trollop' -require 'zipf' - -o = Trollop::options do - opt :grammar, "(Absolute) path of folder containing grammars.", :type => :string, :short => '-g', :default => nil - opt :loo, "leave one out", :type => :bool, :default => false - opt :start_id, "start with this id", :type => :int, :default => 0, :short => '-i' - opt :nogz, "grammar files not gzipped", :type => :bool, :default => false - opt :index, "number according to index", :type => :string, :default => nil -end - -index = [] -if o[:index] - index = ReadFile.readlines_strip(o[:index]).map{ |i| i.to_i } -end - -i = o[:start_id] -j = 0 -while line = STDIN.gets - ext = '.gz' - ext = '' if o[:nogz] - s = "<seg" - if o[:loo] then s += " exclude=\"#{i}\"" end - if index.size > 0 - if o[:grammar] then s += " grammar=\"#{o[:grammar]}/grammar.#{index[j]}#{ext}\"" end - puts s + " id=\"#{index[j]}\"> #{line.strip} </seg>" - else - if o[:grammar] then s += " grammar=\"#{o[:grammar]}/grammar.#{i}#{ext}\"" end - puts s + " id=\"#{i}\"> #{line.strip} </seg>" - end - i += 1 - j += 1 -end - |