summaryrefslogtreecommitdiff
path: root/norm_german
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-11-12 13:57:07 +0100
committerPatrick Simianer <p@simianer.de>2015-11-12 13:57:07 +0100
commit5c2833c505dda0d1646b8f8c1e62abd391f0401e (patch)
tree0259c7c2bdb531c09587a744869848d87f4bbd9e /norm_german
parentef282dbe4fef1b0ae0c8544f0bb84ba674c68de7 (diff)
parent8151031373c08ccd714a99f50783eafcb54d2010 (diff)
Merge branch 'master' of github.com:pks/scripts
Diffstat (limited to 'norm_german')
-rwxr-xr-xnorm_german8
1 files changed, 4 insertions, 4 deletions
diff --git a/norm_german b/norm_german
index ef0408e..cf9c060 100755
--- a/norm_german
+++ b/norm_german
@@ -7,7 +7,7 @@ STDIN.set_encoding 'utf-8'
STDOUT.set_encoding 'utf-8'
-cfg = Trollop::options do
+conf = Trollop::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'
@@ -18,7 +18,7 @@ end
pairs_lower = [ ['ß','ss'], ['ue', 'ü'], ['ae','ä'], ['oe', 'ö'] ]
pairs_upper = [ ['Ä', 'Ae'], ['Ö', 'Oe'], ['Ü', 'Ue'] ]
-if cfg[:upper]
+if conf[:upper]
PAIRS = pairs_lower
else
PAIRS = pairs_lower+pairs_upper
@@ -58,7 +58,7 @@ while tok = STDIN.gets
token_stock << [] if !token_stock[thread_n]
token_stock[thread_n] << tok.strip!
counter += 1
- if token_stock[thread_n].size%cfg[:shard_size]==0
+ if token_stock[thread_n].size%conf[:shard_size]==0
STDERR.write "Starting thread ##{thread_n}\n"
threads << Thread.new(token_stock[thread_n]) { |tokens|
th = build_partial tokens
@@ -71,7 +71,7 @@ while tok = STDIN.gets
else
next
end
- if thread_n==cfg[:threads]
+ if thread_n==conf[:threads]
threads.each { |i| i.join }
token_stock.each { |i| i.clear }
thread_n = 0