Class: SClust::Util::Filter::StemmedWord

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stemmed_word, original_word) ⇒ StemmedWord

Returns a new instance of StemmedWord.



39
40
41
42
43
44
# File 'lib/sclust/util/filters.rb', line 39

def initialize(stemmed_word, original_word)
    #super(stemmed_word)
    @stemmed_word = stemmed_word
    @original_word = String.new(original_word)
    
end

Instance Attribute Details

#original_wordObject

Returns the value of attribute original_word.



36
37
38
# File 'lib/sclust/util/filters.rb', line 36

def original_word
  @original_word
end

#stemmed_wordObject

Returns the value of attribute stemmed_word.



36
37
38
# File 'lib/sclust/util/filters.rb', line 36

def stemmed_word
  @stemmed_word
end

Instance Method Details

#+(sw) ⇒ Object



73
74
75
76
77
78
79
80
81
# File 'lib/sclust/util/filters.rb', line 73

def +(sw)
    if ( sw.nil?)
        self
    elsif (sw.is_a?(String) )
        StemmedWord.new(@stemmed_word + sw, @original_word + sw)
    else
        StemmedWord.new(@stemmed_word + sw.stemmed_word, @original_word + sw.original_word)
    end
end

#<(sw) ⇒ Object



58
59
60
# File 'lib/sclust/util/filters.rb', line 58

def < (sw)
    @stemmed_word< sw.stemmed_word
end

#<=>(sw) ⇒ Object



69
70
71
# File 'lib/sclust/util/filters.rb', line 69

def <=>(sw)
    @stemmed_word <=> sw.stemmed_word
end

#==(sw) ⇒ Object



65
66
67
# File 'lib/sclust/util/filters.rb', line 65

def ==(sw)
    @stemmed_word == sw.stemmed_word
end

#initialize_copy(s) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/sclust/util/filters.rb', line 46

def initialize_copy(s)
    super(s)
    
    if ( stemmed_word.class == "SClust::Filter::StemmedWord" )
        @original_word = s.original_word
    end
end

#to_sObject



54
55
56
# File 'lib/sclust/util/filters.rb', line 54

def to_s() 
    @stemmed_word 
end