(ranking) Suppress NaN:s in ranking output

This commit is contained in:
Viktor Lofgren 2024-04-19 13:58:28 +02:00
parent 426338cb45
commit 3ab563f314

View File

@ -124,11 +124,20 @@ public class ResultValuator {
// Renormalize to 0...15, where 0 is the best possible score;
// this is a historical artifact of the original ranking function
return normalize(
double ret = normalize(
tcfOverlap + tcfJaccard
+ bM25F + bM25P + bM25N
+ overallPartPositive,
overallPartNegative);
if (Double.isNaN(ret)) {
if (getClass().desiredAssertionStatus()) {
throw new IllegalStateException("NaN in result value calculation");
}
return Double.MAX_VALUE;
}
return ret;
}
private double calculateQualityPenalty(int size, int quality, ResultRankingParameters rankingParams) {