Class: TfIdf::Utility

Inherits:
Object
  • Object
show all
Defined in:
lib/utility.rb

Overview

ユーティリティクラス

Constant Summary collapse

N =

(仮の)インデックス数

20000000000

Class Method Summary collapse

Class Method Details

.create_dicObject

df.dicからidf.dicを生成する



18
19
20
21
22
23
24
# File 'lib/utility.rb', line 18

def self.create_dic
  dfs = self.df_load()
  idfs = self.create_idf(dfs)
  self.idf_save(idfs)
  puts "complete."
  puts "size=#{idfs.size} average=#{idfs.average}"
end

.get_inverse(df_value) ⇒ Object

DF値からiDF値を取得する IDF = log(N / DF)

df_value

DF値



29
30
31
# File 'lib/utility.rb', line 29

def self.get_inverse(df_value)
  return df_value > 0 ? Math::log(N / df_value) : 0
end