summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2019-08-09 06:22:32 +0200
committerPatrick Simianer <p@simianer.de>2019-08-09 06:22:32 +0200
commitc76c33a94ba70e447f2681103e559530ae96a5f2 (patch)
tree26233f946cb4469734d613bffd91d73491fb253d
parent7f196f0502e3dd506b3f72033cfdf20588843d2f (diff)
parentbd84f0f2f1eb693ebdf56b92e2aae67cd785d7ce (diff)
Merge branch 'master' of ssh://github.com/pks/nlp_scripts
-rwxr-xr-xnorm-german4
-rwxr-xr-xper-sentence-bleu4
-rwxr-xr-xper-sentence-bleu-kbest4
-rwxr-xr-xper-sentence-ter4
-rwxr-xr-xpt-bloom4
-rwxr-xr-xsample4
-rwxr-xr-xselect4
-rwxr-xr-xselect-from4
-rwxr-xr-xshard4
-rwxr-xr-xsplit-pipes4
-rwxr-xr-xstddev4
-rwxr-xr-xtf-idf4
-rwxr-xr-xtrain-test-split4
-rwxr-xr-xvar4
14 files changed, 28 insertions, 28 deletions
diff --git a/norm-german b/norm-german
index cf9c060..85a39da 100755
--- a/norm-german
+++ b/norm-german
@@ -1,13 +1,13 @@
#!/usr/bin/env ruby
require 'thread'
-require 'trollop'
+require 'optimist'
STDIN.set_encoding 'utf-8'
STDOUT.set_encoding 'utf-8'
-conf = Trollop::options do
+conf = Optimist::options do
banner "norm_german < <file w/ lowercased tokens>"
opt :upper, "uppercase", :type => :bool, :default => false
opt :threads, "#threads", :type => :int, :default => 1, :short => '-h'
diff --git a/per-sentence-bleu b/per-sentence-bleu
index e70db2b..257eb3a 100755
--- a/per-sentence-bleu
+++ b/per-sentence-bleu
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
require 'zipf'
-require 'trollop'
+require 'optimist'
def main
- conf = Trollop::options do
+ conf = Optimist::options do
opt :input, "input", :type => :string, :default => '-'
opt :references, "references", :type => :string, :required => true
opt :len_hack, "hack of Nakov et al", :type => :int, :default => 0
diff --git a/per-sentence-bleu-kbest b/per-sentence-bleu-kbest
index f8bd860..dad1607 100755
--- a/per-sentence-bleu-kbest
+++ b/per-sentence-bleu-kbest
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
require 'zipf'
-require 'trollop'
+require 'optimist'
def main
- conf = Trollop::options do
+ conf = Optimist::options do
opt :kbests, "kbests", :type => :string, :default => '-'
opt :references, "references", :type => :string, :required => true
end
diff --git a/per-sentence-ter b/per-sentence-ter
index f2f2b20..1a7670e 100755
--- a/per-sentence-ter
+++ b/per-sentence-ter
@@ -1,11 +1,11 @@
#!/usr/bin/env ruby
require 'zipf'
-require 'trollop'
+require 'optimist'
require 'tempfile'
def main
- conf = Trollop::options do
+ conf = Optimist::options do
opt :input, "input", :type => :string, :default => '-'
opt :references, "references", :type => :string, :required => true
opt :mteval_bin, "cdec's mteval/fast_score", :type => :string, :default => '`/toolbox/cdec-dtrain/mteval/fast_score'
diff --git a/pt-bloom b/pt-bloom
index 5c2cf01..35234f1 100755
--- a/pt-bloom
+++ b/pt-bloom
@@ -1,12 +1,12 @@
#!/usr/bin/env ruby
require 'bloom-filter'
-require 'trollop'
+require 'optimist'
STDIN.set_encoding 'utf-8'
STDOUT.set_encoding 'utf-8'
-conf = Trollop::options do
+conf = Optimist::options do
opt :size, "number of entries in the filter", :type => :int, :required => true
opt :error_rate, "error rate", :type => :float, :default => 0.01
end
diff --git a/sample b/sample
index 8d3a322..aa46ddb 100755
--- a/sample
+++ b/sample
@@ -1,11 +1,11 @@
#!/usr/bin/env ruby
-require 'trollop'
+require 'optimist'
STDIN.set_encoding 'utf-8'
STDOUT.set_encoding 'utf-8'
-opts = Trollop::options do
+opts = Optimist::options do
banner "sample --size <n> [--shuffle] --file <line separated data>"
opt :size, "Sample P % or # lines from file or N.", :type => :float
opt :shuffle, "Sample is shuffled.", :type => :bool
diff --git a/select b/select
index 9b1eaa8..36e4256 100755
--- a/select
+++ b/select
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby
-require 'trollop'
+require 'optimist'
require 'zipf'
-opts = Trollop::options do
+opts = Optimist::options do
banner "sample --index <n> [--shuffle] [--file <line separated data>]"
opt :file, "Input file.", :type => :string, :default => '-'
opt :index, "Index file.", :type => :string, :required => true
diff --git a/select-from b/select-from
index b1fb2d8..e06e4fb 100755
--- a/select-from
+++ b/select-from
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby
-require 'trollop'
+require 'optimist'
require 'zipf'
-opts = Trollop::options do
+opts = Optimist::options do
banner "select_from [--invert] -i <file> < <line separated data>"
opt :index, "Line numbers to output.", :type => :string, :short => '-i', :required => true
opt :invert, "Invert selection.", :type => :bool, :short => '-j', :default => false
diff --git a/shard b/shard
index 6155123..5294afd 100755
--- a/shard
+++ b/shard
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
-require 'trollop'
+require 'optimist'
def make_shards(input, refs, alignments, output_prefix, num_shards=2, rand=false)
lc = `wc -l #{input}`.split.first.to_i
@@ -67,7 +67,7 @@ def make_shards(input, refs, alignments, output_prefix, num_shards=2, rand=false
return [in_fns, refs_fns]
end
-opts = Trollop::options do
+opts = Optimist::options do
opt :input, 'input', :type => :string, :required => true
opt :references, 'references', :type => :string, :required => true
opt :alignments, 'alignments', :type => :string, :required => true
diff --git a/split-pipes b/split-pipes
index ce8f018..862e8be 100755
--- a/split-pipes
+++ b/split-pipes
@@ -1,11 +1,11 @@
#!/usr/bin/env ruby
-require 'trollop'
+require 'optimist'
STDIN.set_encoding 'utf-8'
STDOUT.set_encoding 'utf-8'
-conf = Trollop::options do
+conf = Optimist::options do
banner "splitpipes -f <n> < <input>"
opt :field, "field", :type => :int, :required => true
opt :to, "to", :type => :int, :default => nil
diff --git a/stddev b/stddev
index 6a29e74..15c245e 100755
--- a/stddev
+++ b/stddev
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
-require 'trollop'
+require 'optimist'
-conf = Trollop::options do
+conf = Optimist::options do
banner "stddev [-r <d>] < <one number per line>"
opt :round, "Number of digits after decimal point.", :type => :int, :default => -1
opt :corrected, "corrected stddev", :type => :bool, :default => false
diff --git a/tf-idf b/tf-idf
index 066548b..22c3dac 100755
--- a/tf-idf
+++ b/tf-idf
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
require 'zipf'
-require 'trollop'
+require 'optimist'
def main
- conf = Trollop::options do
+ conf = Optimist::options do
opt :documents, "input files (documents)", :type => :string, :required => true
opt :filter_stopwords, "filter stopwords (give file)", :type => :string, :default => nil
opt :one_item_per_line, "one item per line (allow multi-word items)", :type => :bool, :default => false
diff --git a/train-test-split b/train-test-split
index cf52455..aa55534 100755
--- a/train-test-split
+++ b/train-test-split
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby
require 'zipf'
-require 'trollop'
+require 'optimist'
-conf = Trollop::options do
+conf = Optimist::options do
opt :foreign, "foreign file", :type => :string, :required => true
opt :english, "english file", :type => :string, :required => true
opt :size, "one size", :type => :int, :required => true
diff --git a/var b/var
index 60f3b9b..8ca6082 100755
--- a/var
+++ b/var
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
-require 'trollop'
+require 'optimist'
-conf = Trollop::options do
+conf = Optimist::options do
banner "stddev [-r <d>] < <one number per line>"
opt :round, "Number of digits after decimal point.", :type => :int, :default => -1
end