From 2b1d7f881c19c4d4b5afae194e02d3300c7675d0 Mon Sep 17 00:00:00 2001 From: Patrick Simianer
Date: Tue, 5 Jul 2016 11:01:46 +0200
Subject: mv
---
add-seg | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100755 add-seg
(limited to 'add-seg')
diff --git a/add-seg b/add-seg
new file mode 100755
index 0000000..e5db580
--- /dev/null
+++ b/add-seg
@@ -0,0 +1,36 @@
+#!/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 = "