def raw_vector_with( word_list )
if $GSL
vec = GSL::Vector.alloc(word_list.size)
else
vec = Array.new(word_list.size, 0)
end
@word_hash.each_key do |word|
vec[word_list[word]] = @word_hash[word] if word_list[word]
end
total_words = vec.sum
if total_words > 1.0
weighted_total = 0.0
vec.each do |term|
if ( term > 0 )
weighted_total += (( term / total_words ) * Math.log( term / total_words ))
end
end
vec = vec.collect { |val| Math.log( val + 1 ) / -weighted_total }
end
if $GSL
@raw_norm = vec.normalize
@raw_vector = vec
else
@raw_norm = Vector[*vec].normalize
@raw_vector = Vector[*vec]
end
end