Class: Splam::Rules::GoodWords

Inherits:
Splam::Rule show all
Defined in:
lib/splam/rules/good_words.rb

Instance Attribute Summary

Attributes inherited from Splam::Rule

#body, #reasons, #score, #suite, #weight

Instance Method Summary collapse

Methods inherited from Splam::Rule

#add_score, inherited, #initialize, #name, run

Constructor Details

This class inherits a constructor from Splam::Rule

Instance Method Details

#runObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/splam/rules/good_words.rb', line 3

def run
  good_words = [ /I\'having a problem/, ]
  good_words |= %w( lighthouse activereload  warehouse install eclipse settings assigned user ticket tickets token api number query request)
  good_words |= %w( browser feed firefox safari skitch vendor rails action_controller railties )
  good_words |= %w( redirect login diff dreamhost setup subversion git  wildcard domain subdomain ssh database )
  good_words |= %w( project billing tags description comment milestone saving happening feature mac implement report)
  good_words |= %w( rss notification subscribe calendar chart note task gantt search service ownership application communicate )
  good_words |= %w( pattern template web integer status xml activereload html state page)
  good_words << "project management"
  good_words << "/usr/local/lib" << "gems"

  body = @body.downcase
  good_words.each { |rule| 
    add_score -5 * body.scan(rule).size, "relevant word match: #{rule}"
  }
end