Custom scoring plugins require a score function.
score contains the following parameters:
const int score(const char *thresholdStr, const uint thresholdSize, const char *inboundStr, const uint inboundSize, const char *candidateStr, const uint candidateSize, char *result, const uint resultSize);
<SCORE_RESULT> <MATCH_SCORE>integer 0-100</MATCH_SCORE> <CONFIRMATION>TRUE/FALSE</CONFIRMATION> </SCORE_RESULT>
<ERROR>error text</ERROR>
The following is a pseudocode example of a score function:
const int score(const char *thresholdStr, const uint thresholdSize, const char *inboundStr, const uint inboundSize, const char *candidateStr, const uint candidateSize, char *result, const uint resultSize) { //create strings out of thresholdStr, inboundStr, and candidateStr //create XML documents out of thresholdStr, inboundStr, and candidateStr //parse thresholds out of threshold xml doc if thresholds are used //parse values out of inbound xml doc //parse values out of candidate xml doc //check for any errors such as attr type mismatches, bad data, etc. //un-encode attr_value and attr_large_data data fields if necessary //apply scoring algorithm to attribute data //scale score into 0-100 range //determine confirmation or denial (possibly using thresholds) //if there was an error, create null terminated error string and //strcpy into result. Return -1. //if no error, create null terminated result document and strcpy into //result. Return 0. }
The score function should return -1 if an error is encountered.