MCPcopy Create free account
hub / github.com/driangle/taskmd / bestFuzzyScore

Function bestFuzzyScore

apps/cli/internal/cli/get.go:270–277  ·  view source on GitHub ↗

bestFuzzyScore returns the best similarity score between query and the task's ID or title.

(query string, task *model.Task)

Source from the content-addressed store, hash-verified

268
269// bestFuzzyScore returns the best similarity score between query and the task's ID or title.
270func bestFuzzyScore(query string, task *model.Task) float64 {
271 idScore := calculateSimilarity(query, task.ID)
272 titleScore := calculateSimilarity(query, task.Title)
273 if idScore > titleScore {
274 return idScore
275 }
276 return titleScore
277}
278
279// calculateSimilarity returns a similarity score between 0.0 and 1.0.
280// Substring containment scores 0.7-1.0; otherwise Levenshtein distance is used.

Callers 1

fuzzyMatchTasksFunction · 0.85

Calls 1

calculateSimilarityFunction · 0.85

Tested by

no test coverage detected