Class: Stopword
- Inherits:
-
Object
- Object
- Stopword
- Defined in:
- lib/bayes_on_redis.rb
Instance Method Summary collapse
-
#initialize ⇒ Stopword
constructor
A new instance of Stopword.
- #to_a ⇒ Object
- #to_re ⇒ Object
Constructor Details
#initialize ⇒ Stopword
Returns a new instance of Stopword.
96 97 98 |
# File 'lib/bayes_on_redis.rb', line 96 def initialize @stopwords = File.read(File.(File.join(__FILE__, "..", "..", "datasets", "stopwords.txt"))).split end |
Instance Method Details
#to_a ⇒ Object
100 101 102 |
# File 'lib/bayes_on_redis.rb', line 100 def to_a @stopwords end |
#to_re ⇒ Object
104 105 106 |
# File 'lib/bayes_on_redis.rb', line 104 def to_re @to_re ||= /\b(#{@stopwords.join('|')})\b/mi end |