Skip to content

Commit 1f13c41

Browse files
committed
Merge pull request #11 from jekyll/jekyll/jekyll/2743
2 parents be95c7f + d605417 commit 1f13c41

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/classifier-reborn/lsi/content_node.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,13 @@ def raw_vector_with( word_list )
4545

4646
# Perform the scaling transform and force floating point arithmetic
4747
total_words = vec.sum.to_f
48+
total_unique_words = 0
4849

49-
total_unique_words = vec.count{|word| word != 0}
50+
if $GSL
51+
vec.each { |word| total_unique_words += 1 if word != 0 }
52+
else
53+
total_unique_words = vec.count{ |word| word != 0 }
54+
end
5055

5156
# Perform first-order association transform if this vector has more
5257
# then one word in it.

0 commit comments

Comments
 (0)