class TfIdf::Dictionary
辞書基底クラス
Public Class Methods
new()
click to toggle source
コンストラクタ
# File lib/dictionary.rb, line 11 def initialize @map = {} end
Public Instance Methods
all()
click to toggle source
辞書全体を返却する
- value
-
ハッシュテーブル
# File lib/dictionary.rb, line 31 def all return @map end
exists?(k)
click to toggle source
keyが存在するか検査する
- k
-
検査するkey
- return
-
true=存在する faluse=存在しない
# File lib/dictionary.rb, line 38 def exists?(k) return @map.key?(k) end
get(k)
click to toggle source
keyからvalueを取得する
- k
-
key
- return
-
value
# File lib/dictionary.rb, line 25 def get(k) return @map[k] end
set(k, v)
click to toggle source
辞書にkeyとvalueを設定する
- k
-
key
- v
-
value
# File lib/dictionary.rb, line 18 def set(k, v) @map[k] = v end