rankEntries
Function: rankEntries()
rankEntries(
scorerName,candidates,rawScores):EntryScoring
Defined in: src/lib/injection-engine/entryScorer.ts:85
Shared finisher: raw scores → EntryScoring. Softmax turns the (sanitized) raw
scores into a relevance share (sums to 1); the winner is the argmax with
declaration order breaking ties. Because softmax is order-preserving over the
sanitized scores, the WINNER is always the argmax relevance — the surfaced %
and the pick can never disagree.
EntryScorer is a public, consumer-implementable interface, so a third-party
scorer might return NaN / ±Infinity. We sanitize those to -Infinity for BOTH
the softmax input AND the winner pick, so a non-finite score can never silently win
(NaN > x is always false — a leading NaN would otherwise seed-and-keep a naive
reduce) and the softmax stays well-defined. The raw (possibly non-finite) score is
still surfaced on EntryScore.score for honest debugging.
Parameters
scorerName
string
candidates
readonly EntryCandidate[]
rawScores
readonly number[]
