summaryrefslogtreecommitdiff
path: root/lib/nlp_ruby/SparseVector.rb
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 /lib/nlp_ruby/SparseVector.rb
parentbd9d9cbe8252d4d32b0c414009b85267fffae1ce (diff)
misc
Diffstat (limited to 'lib/nlp_ruby/SparseVector.rb')
-rw-r--r--lib/nlp_ruby/SparseVector.rb9
1 files changed, 9 insertions, 0 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