Class: SClust::Util::DocumentTermFilter

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

Overview

Filters a document term

Instance Method Summary collapse

Methods inherited from Filter

#after, #apply, #before

Constructor Details

#initializeDocumentTermFilter

Returns a new instance of DocumentTermFilter.



185
186
187
188
189
190
191
# File 'lib/sclust/util/filters.rb', line 185

def initialize()
    super()
    after(LowercaseFilter.new())
    after(StopwordFilter.new())
    after(TrimWhitespace.new())
    #after(StemFilter.new())
end

Instance Method Details

#filter(term) ⇒ Object

Return nil if the term should be excluded. Otherwise the version of the term that should be included is returned.



195
196
197
198
199
200
201
# File 'lib/sclust/util/filters.rb', line 195

def filter(term)
    if ( term =~ /^[\d\.]+$/ )
        nil
    else
        term
    end
end