summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2014-02-14 15:54:15 +0100
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2014-02-14 15:54:15 +0100
commit32f0468ecff9f89598a68598d45acbd67aa50ab5 (patch)
tree3790332863fc819ed2400bc312d0aacd279725f0
parentbd9d9cbe8252d4d32b0c414009b85267fffae1ce (diff)
misc
-rw-r--r--lib/nlp_ruby/SparseVector.rb9
-rw-r--r--lib/nlp_ruby/cdec.rb2
-rw-r--r--lib/nlp_ruby/ttable.rb2
3 files changed, 10 insertions, 3 deletions
diff --git a/lib/nlp_ruby/SparseVector.rb b/lib/nlp_ruby/SparseVector.rb
index 6843b70..cdf966c 100644
--- a/lib/nlp_ruby/SparseVector.rb
+++ b/lib/nlp_ruby/SparseVector.rb
@@ -80,6 +80,15 @@ class SparseVector < Hash
return a.join ' '
end
+ # FIXME
+ def to_kv2 sep='='
+ a = []
+ self.each_pair { |k,v|
+ a << "#{k}#{sep}#{v}"
+ }
+ return a.join "\n"
+ end
+
def join_keys other
self.keys + other.keys
end
diff --git a/lib/nlp_ruby/cdec.rb b/lib/nlp_ruby/cdec.rb
index 46651a3..1080f14 100644
--- a/lib/nlp_ruby/cdec.rb
+++ b/lib/nlp_ruby/cdec.rb
@@ -8,8 +8,6 @@ CDEC_BINARY = "/toolbox/cdec-dtrain/decoder/cdec"
def CDEC::kbest input, ini, weights, k, unique=true
- puts "asdf #{`cat #{weights}`}"
- puts "echo \"#{input}\" | #{CDEC_BINARY} -c #{ini} -w #{weights} -k #{k} -r 2>/dev/null"
o, s = Open3.capture2 "echo \"#{input}\" | #{CDEC_BINARY} -c #{ini} -w #{weights} -k #{k} -r 2>/dev/null"
j = -1
ret = []
diff --git a/lib/nlp_ruby/ttable.rb b/lib/nlp_ruby/ttable.rb
index 14d6c5d..c0f37be 100644
--- a/lib/nlp_ruby/ttable.rb
+++ b/lib/nlp_ruby/ttable.rb
@@ -51,7 +51,7 @@ class Translation
end
def to_s2
- [@rank, @s, @f.to_kv, @score, @other_score].join ' ||| '
+ [@rank, @s, @score, @other_score].join ' ||| '
end
end