dca_interface  6.3.4
Zero Level Analysis (ZLA)

The ZLA Classifier (Zero Level Analysis) is a very fast managed Spam classifier. The ZLA Classification classifies an email according to Spam, Ham or NDR (Non-Delivery Report).

Initialization

To use the ZLA classification functions, the ZLA Classification Package must first be initialized. To do this, create an instance of the dca::ZlaClassification module using dca::ZlaClassification::create().

Once the ZLA Classification module has been initialized, a dca::ZlaClassifier object must be created. Use dca::ZlaClassification::createClassifier() to create a ZLA Classifier.

The ZlaClassifier class classifies dca::Email objects. To create an Email object from a raw email data string, use dca::Email::create(). Note that the email data must be compatible to RFC 2822.

Classification

To classify an Email object, use dca::ZlaClassifier::classify(). This function analyzes the Email object and returns the results of a classification in a dca::ZlaClassificationResult object.

Classifier Management

The ZLA Classifier is an out-of-the-box solution for fast Spam filtering. The Classifier is managed by IBM, and receives regular content updates to maintain a high detection rate. To keep the classifier up-to-date, we recommend an update and schedule interval of 5 minutes at the most.

Example code

The following code demonstrates the classification of an email.

// assume we have a valid DcaInstance (myDca) and License (myLicense)
// initialize the ZLA Classification module
dca::ZlaClassification myZlaClassification =
dca::ZlaClassification::create( myDca, myLicense );
// create a ZLA Classifier
dca::ZlaClassifier myZlaClassifier = myZlaClassification.createClassifier();
// create an email object
// assume we have the contents of a valid RFC 2822 conform email in
// std::string myEmailContent
dca::Email myEmail = dca::Email::create( myDca, myEmailContent );
// declare the classification results
dca::ZlaClassificationResult myZlaClassificationResult;
// run the classification
myZlaClassifier.classify( myEmail, myZlaClassificationResult );
// if myResult returns false an error occurred
if( !myResult ) {
std::cout << "Received error from ZLA Classification (Error code: " <<
myResult.getReturnCode() << ", Description: " <<
myResult.getDescription() << ")." << std::endl;
return;
}
std::cout << "Result=" << myZlaClassificationResult.result() <<
", Module=" << myZlaClassificationResult.module();
if( myZlaClassificationResult.result() == ZLA_SPAM ) {
std::cout << " SPAM";
}
else if( myZlaClassificationResult.result() == ZLA_HAM ) {
std::cout << " HAM";
}
else if( myZlaClassificationResult.result() == ZLA_NDR ) {
std::cout << " NDR";
}
else if( myZlaClassificationResult.result() == ZLA_UNKNOWN ) {
std::cout << " UNKNOWN";
}
DCA_ZLA_RESULT result() const
Returns the result for the ZLA classification.
ZLA classifier object for ZLA classification.
static ZlaClassification create(const DcaInstance &aDcaInstance, const License &aLicense)
Initializes the ZlaClassification module.
DCA_RESULT_TYPE getReturnCode() const
Returns the last error code (if any).
const DCA_ZLA_RESULT ZLA_HAM
The email data is classified as HAM.
The ZLA Classification module class.
Encapsulates an email object.
Definition: base_email.h:24
const DCA_ZLA_RESULT ZLA_UNKNOWN
The email data is unknown i.e. there was not enough data for classification or no ZLA match.
const DCA_ZLA_RESULT ZLA_SPAM
The email data is classified as SPAM.
Overall result of a ZLA classification.
static Email create(const DcaInstance &aDcaInstance, const std::string &emailContent)
Creates an email object, used as an input parameter for ZLA classification.
DCA_ZLA_TYPE module() const
Returns the module type for the ZLA classification.
const DCA_ZLA_RESULT ZLA_NDR
The email data is classified as NDR (non-delivery-report)
FunctionResult classify(const Email &anEmail, ZlaClassificationResult &aZlaResult) const
The email classification method. The method takes an initialized Email object and returns the results...
std::string getDescription() const
Returns the description for the error or warning.
Standard function result.
Definition: base_classes.h:148
ZlaClassifier createClassifier(const DbConnection &aDbConnection) const
Creates a ZlaClassifier used to classify Email objects.