feat(wing): backtest metric (coverage/precision at a threshold) and shared TopWing (#205 S1)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 05:58:55 +02:00
co-authored by Claude Sonnet 5.5
parent c06509afe4
commit 365130459f
3 changed files with 89 additions and 1 deletions
+8 -1
View File
@@ -147,8 +147,15 @@ func (r Resolver) scorerTop(text string) (string, bool) {
if r.Scorer == nil {
return "", false
}
return TopWing(r.Scorer.Score(text))
}
// TopWing returns the unique highest-scoring wing in scores, or false when
// there is none or the top is tied. Shared by the Resolver and the backtest so
// both apply the same notion of "the scorer has an opinion".
func TopWing(scores map[string]float64) (string, bool) {
best, bestScore, tied := "", 0.0, false
for k, v := range r.Scorer.Score(text) {
for k, v := range scores {
switch {
case v > bestScore:
best, bestScore, tied = norm(k), v, false