Class: Stopword

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

Instance Method Summary collapse

Constructor Details

#initializeStopword

Returns a new instance of Stopword.



96
97
98
# File 'lib/bayes_on_redis.rb', line 96

def initialize
  @stopwords = File.read(File.expand_path(File.join(__FILE__, "..", "..", "datasets", "stopwords.txt"))).split
end

Instance Method Details

#to_aObject



100
101
102
# File 'lib/bayes_on_redis.rb', line 100

def to_a
  @stopwords
end

#to_reObject



104
105
106
# File 'lib/bayes_on_redis.rb', line 104

def to_re
  @to_re ||= /\b(#{@stopwords.join('|')})\b/mi
end