dca_interface  6.3.4
dca::ZlaClassifier Class Reference

#include <zla_classifier.h>

Detailed Description

ZLA classifier object for ZLA classification.

See also
ZlaClassification, ZlaClassificationResult

The following sample shows the ZLA classification workflow:

// 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";
}

Definition at line 32 of file zla_classifier.h.

Public Member Functions

FunctionResult classify (const Email &anEmail, ZlaClassificationResult &aZlaResult) const
 The email classification method. The method takes an initialized Email object and returns the results in a ZlaClassificationResult object. More...
 

Member Function Documentation

◆ classify()

FunctionResult dca::ZlaClassifier::classify ( const Email anEmail,
ZlaClassificationResult aZlaResult 
) const

The email classification method. The method takes an initialized Email object and returns the results in a ZlaClassificationResult object.

Parameters
[in]anEmailThe Email object to be classified
[out]aZlaResultThe result of the ZLA Email classification
Returns
DCA_SUCCESS or one of the following error codes
See also
ZlaClassification, Email, ZlaClassificationResult

The documentation for this class was generated from the following file:
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.