chore: sort.Slice → slices.SortFunc

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude 2026-02-24 16:23:47 +00:00
parent c46516884a
commit c8a23f32b9
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -3,6 +3,7 @@ package reversal
import (
"errors"
"math"
"slices"
"sort"
)
@ -105,7 +106,15 @@ func (rs *ReferenceSet) Classify(imprint GrammarImprint) ImprintClassification {
for d, m := range distances {
ranked = append(ranked, scored{d, m.CosineSimilarity})
}
sort.Slice(ranked, func(i, j int) bool { return ranked[i].sim > ranked[j].sim })
slices.SortFunc(ranked, func(a, b scored) int {
if a.sim > b.sim {
return -1
}
if a.sim < b.sim {
return 1
}
return 0
})
result := ImprintClassification{Distances: distances}
if len(ranked) > 0 {