summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-06-17 16:52:59 +0200
committerPatrick Simianer <p@simianer.de>2014-06-17 16:52:59 +0200
commitf28694f9bdd5059050e420cca2ca2694cbb0dda4 (patch)
treefd07ef865a8e49fef0268850143a92f1d3b0f190
parent773f13eab521db5dadd993c00dc4c780970d5d2e (diff)
fix -> 1.0.3
-rw-r--r--lib/zipf/SparseVector.rb10
-rw-r--r--zipf.gemspec2
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/zipf/SparseVector.rb b/lib/zipf/SparseVector.rb
index 33bb396..3f950c4 100644
--- a/lib/zipf/SparseVector.rb
+++ b/lib/zipf/SparseVector.rb
@@ -55,9 +55,9 @@ class SparseVector < Hash
return a.join join
end
- def from_kv s
- s.split.each { |i|
- k,v = i.split('=')
+ def from_kv s, sep='=', join=/\s/
+ s.split(join).each { |i|
+ k,v = i.split(sep)
self[k] = v.to_f
}
end
@@ -76,9 +76,9 @@ class SparseVector < Hash
return v
end
- def self.from_kv s
+ def self.from_kv s, sep='=', join=/\s/
v = SparseVector.new
- v.from_kv s
+ v.from_kv s, sep, join
return v
end
diff --git a/zipf.gemspec b/zipf.gemspec
index 5e6fcd1..99fe588 100644
--- a/zipf.gemspec
+++ b/zipf.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'zipf'
- s.version = '1.0.2'
+ s.version = '1.0.3'
s.date = '2014-06-17'
s.summary = 'zipf'
s.description = 'NLP related tools and classes'