diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-06-08 15:03:43 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-06-08 15:03:43 -0400 |
commit | 0d6822ee71c1f60c8003e13ab149501e586f9ae6 (patch) | |
tree | f886afe12f57e300bef5c56e2ac26627647609f7 /src | |
parent | 30f4d71b637d30751a6eb00bafdb423ce69f9850 (diff) | |
download | bfs-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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; |