MCPcopy Create free account
hub / github.com/diillson/chatcli / countDistinctVerbs

Function countDistinctVerbs

cli/agent/quality/plan_complexity.go:127–139  ·  view source on GitHub ↗

countDistinctVerbs counts unique action verbs in lower (already lower-cased), up to cap. Word boundaries are enforced via Fields, which keeps the scorer simple and Unicode-safe.

(lower string, limit int)

Source from the content-addressed store, hash-verified

125// lower-cased), up to cap. Word boundaries are enforced via Fields,
126// which keeps the scorer simple and Unicode-safe.
127func countDistinctVerbs(lower string, limit int) int {
128 seen := make(map[string]struct{})
129 for _, raw := range strings.Fields(lower) {
130 w := strings.Trim(raw, ".,;:!?()[]{}\"'`")
131 if _, ok := actionVerbs[w]; ok {
132 seen[w] = struct{}{}
133 if len(seen) >= limit {
134 return limit
135 }
136 }
137 }
138 return len(seen)
139}
140
141// countDistinctMatches dedupes a slice and returns count up to limit.
142func countDistinctMatches(matches []string, limit int) int {

Callers 1

ComplexityScoreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected