tf-idf-similarity 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,11 @@
2
2
  begin
3
3
  require 'gsl'
4
4
  rescue LoadError
5
- require 'narray'
6
- rescue LoadError
7
- require 'matrix'
5
+ begin
6
+ require 'narray'
7
+ rescue LoadError
8
+ require 'matrix'
9
+ end
8
10
  end
9
11
 
10
12
  class TfIdfSimilarity::Collection
@@ -142,7 +144,7 @@ class TfIdfSimilarity::Collection
142
144
  matrix.each_col(&:normalize!)
143
145
  elsif narray?
144
146
  # @see https://github.com/masa16/narray/issues/21
145
- NMatrix.refer matrix / NMath.sqrt((matrix ** 2).sum(1).reshape(5,1))
147
+ NMatrix.refer matrix / NMath.sqrt((matrix ** 2).sum(1).reshape(documents.size, 1))
146
148
  elsif nmatrix?
147
149
  # @todo NMatrix has no way to perform scalar operations on matrices.
148
150
  # (0...matrix.shape[0]).each do |i|
@@ -1,3 +1,3 @@
1
1
  module TfIdfSimilarity
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tf-idf-similarity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-29 00:00:00.000000000 Z
12
+ date: 2012-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: unicode_utils