La personalización de plugins de puntuación necesita una función de puntuación.
score contiene los parámetros siguientes:
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>
A continuación se muestra un ejemplo de pseudocódigo de una función de puntuación:
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. }
La función de puntuación debe devolver -1 si se produce un error.