summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-06-08 15:03:43 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-06-08 15:03:43 -0400
commit0d6822ee71c1f60c8003e13ab149501e586f9ae6 (patch)
treef886afe12f57e300bef5c56e2ac26627647609f7 /src
parent30f4d71b637d30751a6eb00bafdb423ce69f9850 (diff)
downloadbfs-0d6822ee71c1f60c8003e13ab149501e586f9ae6.tar.xz
typo: Raise the insert/delete cost
It should be at least half the max char distance so that we mostly get replacements, not inserts + deletes.
Diffstat (limited to 'src')
-rw-r--r--src/typo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/typo.c b/src/typo.c
index b1c5c44..cb826fc 100644
--- a/src/typo.c
+++ b/src/typo.c
@@ -125,7 +125,7 @@ int typo_distance(const char *actual, const char *expected) {
// This is the Wagner-Fischer algorithm for Levenshtein distance, using
// Manhattan distance on the keyboard for individual characters.
- const int insert_cost = 12;
+ const int insert_cost = (40 + 12 + 1) / 2;
size_t rows = strlen(actual) + 1;
size_t cols = strlen(expected) + 1;