diff options
author | Patrick Simianer <p@simianer.de> | 2015-06-23 16:03:23 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2015-06-23 16:03:23 +0200 |
commit | 14f7bbab028d781cd2057a348862f911324338fd (patch) | |
tree | 170df2d80cb4aea161700e26bd951d06276a81f5 /de-tok.rb | |
parent | 553d54484725614fa73e805b59136a39e6dee295 (diff) |
overhaul
Diffstat (limited to 'de-tok.rb')
-rwxr-xr-x | de-tok.rb | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/de-tok.rb b/de-tok.rb deleted file mode 100755 index 92c563f..0000000 --- a/de-tok.rb +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env ruby - -require 'nanomsg' -require 'open3' -require 'trollop' - -conf = Trollop::options do - opt :action, "tokenize (T) or detokenize (D)", :type => :string, :requred => true - opt :addr, "socket address", :short => "-S", :type => :string, :required => true - opt :scripts, "path to scripts directory", :short => "-p", :type => :string, :required => true - opt :lang, "language", :short => "-l", :type => :string, :required => true -end - -sock = NanoMsg::PairSocket.new -sock.bind conf[:addr] -sock.send "hello" - -if conf[:action] == "D" - cmd = "#{conf[:scripts]}/detokenizer.perl -q -b -u -l #{conf[:lang]}" -elsif conf[:action] == "T" - cmd = "#{conf[:scripts]}/tokenizer-no-escape.perl -q -b -a -l #{conf[:lang]}" -else - # ERROR -end -while true - inp = sock.recv - break if !inp||inp=="shutdown" - Open3.popen3(cmd) do |pin, pout, perr| - pin.write inp - pin.close - sock.send pout.gets.strip - end -end - -sock.send "off" - |