Class: Swallow::DSpamEngine
- Inherits:
-
SpamDetector
- Object
- SpamDetector
- Swallow::DSpamEngine
- Defined in:
- lib/spamdetector.rb
Instance Method Summary collapse
- #generate_cmd(params) ⇒ Object
-
#initialize(add_params = nil) ⇒ DSpamEngine
constructor
A new instance of DSpamEngine.
Methods inherited from SpamDetector
#is_innocent?, #is_spam?, #process_folder, #train_and_clean_folder, #train_and_retain_folder, #train_emails_as_innocent, #train_emails_as_spam
Constructor Details
#initialize(add_params = nil) ⇒ DSpamEngine
Returns a new instance of DSpamEngine.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/spamdetector.rb', line 97 def initialize(add_params = nil) @base_cmd="dspam" if add_params == nil then @cmd_params = Hash.new else @cmd_params = add_params end if @cmd_params[:mode] == nil @cmd_params[:mode] = "teft" end if @cmd_params[:path] != nil @base_cmd=@cmd_params[:path] end if pipe(@base_cmd + " --version", "") == 127 throw IOError end end |
Instance Method Details
#generate_cmd(params) ⇒ Object
115 116 117 118 119 120 121 |
# File 'lib/spamdetector.rb', line 115 def generate_cmd(params) if params.kind_of? Hash return "#{@base_cmd} --mode=#{@cmd_params[:mode]} --source=#{params[:source]} --class=#{params[:class]} --feature=noise --user=#{ENV['USER']}" else return "#{@base_cmd} --mode=#{@cmd_params[:mode]}" end end |