Class which allows applications to detect spam e-mails with self-learning Bayesian filter. More...
Inherits Object.
Public Member Functions | |
System::SharedPtr< BayesianFilter > | get_Filter () const |
For testing only. More... | |
SpamAnalyzer () | |
Initialize a new instance of the Aspose::Email::AntiSpam::SpamAnalyzer class. More... | |
SpamAnalyzer (System::SharedPtr< System::IO::Stream > stream) | |
Initialize a new instance of the Aspose::Email::AntiSpam::SpamAnalyzer class. More... | |
SpamAnalyzer (System::String filePath) | |
Initialize a new instance of the Aspose::Email::AntiSpam::SpamAnalyzer class. More... | |
void | TrainFilter (System::ArrayPtr< System::SharedPtr< MailMessage >> ham, System::ArrayPtr< System::SharedPtr< MailMessage >> spam) |
Learns from the specified messages as from spam or non-spam source. More... | |
void | TrainFilter (System::SharedPtr< MailMessage > message, bool isSpam) |
Learns from the specified message as from spam or non-spam source. More... | |
void | TrainFilter (System::String text, bool isSpam) |
Learns from the specified string as from spam or non-spam source. More... | |
double | Test (System::SharedPtr< MailMessage > message) |
Analyses the message and returns the probability of the message being spam. More... | |
void | LoadDatabase (System::String filePath) |
Loads Bayesian database from file. More... | |
void | LoadDatabase (System::SharedPtr< System::IO::Stream > stream) |
Loads Bayesian database from stream. More... | |
void | SaveDatabase (System::String filePath) |
Saves the Bayesian database to file. More... | |
void | SaveDatabase (System::SharedPtr< System::IO::Stream > stream) |
Saves the Bayesian database to stream. More... | |
void | Reset () |
Clears all statistics (Bayesian database). More... | |
Class which allows applications to detect spam e-mails with self-learning Bayesian filter.
Aspose::Email::AntiSpam::SpamAnalyzer::SpamAnalyzer | ( | ) |
Initialize a new instance of the Aspose::Email::AntiSpam::SpamAnalyzer class.
Aspose::Email::AntiSpam::SpamAnalyzer::SpamAnalyzer | ( | System::SharedPtr< System::IO::Stream > | stream | ) |
Initialize a new instance of the Aspose::Email::AntiSpam::SpamAnalyzer class.
stream | An input stream containing Bayesian database. |
ArgumentNullException | If stream is null. |
Aspose::Email::AntiSpam::SpamAnalyzer::SpamAnalyzer | ( | System::String | filePath | ) |
Initialize a new instance of the Aspose::Email::AntiSpam::SpamAnalyzer class.
filePath | The full or relative path to the file containing Bayesian database. |
ArgumentException | If filePath is null or an empty string. |
System::SharedPtr<BayesianFilter> Aspose::Email::AntiSpam::SpamAnalyzer::get_Filter | ( | ) | const |
For testing only.
void Aspose::Email::AntiSpam::SpamAnalyzer::LoadDatabase | ( | System::SharedPtr< System::IO::Stream > | stream | ) |
Loads Bayesian database from stream.
stream | An input stream containing Bayesian database. |
ArgumentNullException | If stream is null. |
void Aspose::Email::AntiSpam::SpamAnalyzer::LoadDatabase | ( | System::String | filePath | ) |
Loads Bayesian database from file.
filePath | The full or relative path to the file containing Bayesian database. |
ArgumentException | If filePath is null or an empty string. |
void Aspose::Email::AntiSpam::SpamAnalyzer::Reset | ( | ) |
Clears all statistics (Bayesian database).
void Aspose::Email::AntiSpam::SpamAnalyzer::SaveDatabase | ( | System::SharedPtr< System::IO::Stream > | stream | ) |
Saves the Bayesian database to stream.
stream | An output stream containing Bayesian database. |
ArgumentNullException | If stream is null. |
void Aspose::Email::AntiSpam::SpamAnalyzer::SaveDatabase | ( | System::String | filePath | ) |
Saves the Bayesian database to file.
filePath | The full or relative path to the file containing Bayesian database. |
ArgumentException | If filePath is null or an empty string. |
double Aspose::Email::AntiSpam::SpamAnalyzer::Test | ( | System::SharedPtr< MailMessage > | message | ) |
Analyses the message and returns the probability of the message being spam.
message | MailMessage for test the probability of the message being spam. |
ArgumentNullException | If message is null. |
void Aspose::Email::AntiSpam::SpamAnalyzer::TrainFilter | ( | System::ArrayPtr< System::SharedPtr< MailMessage >> | ham, |
System::ArrayPtr< System::SharedPtr< MailMessage >> | spam | ||
) |
Learns from the specified messages as from spam or non-spam source.
ham | The array of MailMessage objects that is non-spam for training the Bayesian filter. |
spam | The array of MailMessage objects that is spam for training the Bayesian filter. |
ArgumentNullException | If ham or spam is null. |
void Aspose::Email::AntiSpam::SpamAnalyzer::TrainFilter | ( | System::SharedPtr< MailMessage > | message, |
bool | isSpam | ||
) |
Learns from the specified message as from spam or non-spam source.
message | A reference to the MailMessage object representing the message to train the Bayesian filter. |
isSpam | True if the message is a spam; false if it's a legitimate message. |
ArgumentNullException | If message is null. |
void Aspose::Email::AntiSpam::SpamAnalyzer::TrainFilter | ( | System::String | text, |
bool | isSpam | ||
) |
Learns from the specified string as from spam or non-spam source.
text | A string value to train the Bayesian filter. |
isSpam | True if specified text is a spam; false if it's a legitimate text. |
ArgumentNullException | If text is null. |