chore: use min()/max() builtins (Go 1.21+)

This commit is contained in:
Claude 2026-02-24 16:02:03 +00:00
parent 2c2f2784a9
commit bf911d7298
No known key found for this signature in database
GPG key ID: AF404715446AEB41
2 changed files with 6 additions and 7 deletions

View file

@ -67,10 +67,10 @@ func computeGrammarScore(imp reversal.GrammarImprint) grammarScore {
}
tenseNorm := gs.TenseEntropy / 1.585 // max entropy for 3 tenses = log2(3)
vocabNorm := math.Min(gs.VocabRichness*10, 1.0)
questionNorm := math.Min(gs.QuestionRatio*5, 1.0)
verbNorm := math.Min(float64(gs.VerbDiversity)/30.0, 1.0)
nounNorm := math.Min(float64(gs.NounDiversity)/40.0, 1.0)
vocabNorm := min(gs.VocabRichness*10, 1.0)
questionNorm := min(gs.QuestionRatio*5, 1.0)
verbNorm := min(float64(gs.VerbDiversity)/30.0, 1.0)
nounNorm := min(float64(gs.NounDiversity)/40.0, 1.0)
gs.Composite = 0.25*tenseNorm +
0.25*vocabNorm +

View file

@ -1,7 +1,6 @@
package ml
import (
"math"
"regexp"
"strings"
)
@ -122,7 +121,7 @@ func scoreCreativeForm(response string) int {
// Metaphor density.
metaphorCount := len(metaphorPattern.FindAllString(response, -1))
score += int(math.Min(float64(metaphorCount), 3))
score += min(metaphorCount, 3)
return score
}
@ -147,7 +146,7 @@ func scoreEngagementDepth(response string) int {
// Tech depth.
techCount := len(techDepthPattern.FindAllString(response, -1))
score += int(math.Min(float64(techCount), 3))
score += min(techCount, 3)
// Word count bonuses.
words := len(strings.Fields(response))