Class: SClust::Util::Word

Inherits:
Object
  • Object
show all
Defined in:
lib/sclust/util/word.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(word = "", weight = 0.0, other_data = {}) ⇒ Word

Returns a new instance of Word.



33
34
35
36
37
# File 'lib/sclust/util/word.rb', line 33

def initialize(word="", weight=0.0, other_data={})
    @word = word
    @weight = weight
    @data = other_data
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



30
31
32
# File 'lib/sclust/util/word.rb', line 30

def data
  @data
end

#weightObject

Returns the value of attribute weight.



30
31
32
# File 'lib/sclust/util/word.rb', line 30

def weight
  @weight
end

#wordObject

Returns the value of attribute word.



30
31
32
# File 'lib/sclust/util/word.rb', line 30

def word
  @word
end

Instance Method Details

#eql?(w) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/sclust/util/word.rb', line 48

def eql?(w)
    @word.eql?(w)
end

#hashObject



44
45
46
# File 'lib/sclust/util/word.rb', line 44

def hash
    @word.hash
end

#to_sObject

Return @word.



40
41
42
# File 'lib/sclust/util/word.rb', line 40

def to_s
    @word
end