summaryrefslogtreecommitdiff
path: root/internal/levenshtein/levenshtein.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/levenshtein/levenshtein.go')
-rw-r--r--internal/levenshtein/levenshtein.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/levenshtein/levenshtein.go b/internal/levenshtein/levenshtein.go
index 631161e..cf28607 100644
--- a/internal/levenshtein/levenshtein.go
+++ b/internal/levenshtein/levenshtein.go
@@ -34,12 +34,14 @@ func levenshtein(os, ot string) int {
v0[i] = i
}
+ // loop through every word in the first string
for i := 0; i < n; i++ {
v1[0] = i + 1
for j := 0; j < m; j++ {
// calculate deletion cost,
// insertion cost and
- // substitution cost
+ // substitution cost to get from the string
+ // to the target
dc := v0[j+1] + 1
ic := v1[j] + 1
var sc int
@@ -71,6 +73,7 @@ func adjusted(substr, full string) int {
}
// KeywordPenalty is the penalty for matching on keywords instead of display names
+// We have a penalty for matching on keywords because currently there are a lot of generic keywords
const KeywordPenalty = 2
// DiscoveryScore computes the score of a discovery entry with the given search query