Angepasste Scoring-Plug-ins erfordern eine Funktion 'score'.
score enthält folgende Parameter:
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>ganze Zahl 0-100</MATCH_SCORE> <CONFIRMATION>TRUE/FALSE</CONFIRMATION> </SCORE_RESULT>
<ERROR>Fehlertext</ERROR>
Es folgt ein Pseudocodebeispiel der Funktion 'score':
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. }
Die Funktion 'score' sollte beim Auftreten eines Fehlers '-1' zurückgeben.