MCPcopy Index your code
hub / github.com/github/github-mcp-server / normalizedSimilarity

Function normalizedSimilarity

pkg/tooldiscovery/search.go:288–302  ·  view source on GitHub ↗
(a, b string)

Source from the content-addressed store, hash-verified

286}
287
288func normalizedSimilarity(a, b string) float64 {
289 if len(a) == 0 || len(b) == 0 {
290 return 0
291 }
292
293 distance := fuzzy.LevenshteinDistance(a, b)
294 maxLen := max(len(b), len(a))
295
296 similarity := 1 - (float64(distance) / float64(maxLen))
297 if similarity < 0 {
298 return 0
299 }
300
301 return similarity
302}
303
304func splitTokens(s string) []string {
305 if s == "" {

Callers 1

scoreToolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected