diff options
author | Laurent Le Brun <laurentlb@google.com> | 2017-03-20 16:59:12 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2017-03-21 12:49:58 +0000 |
commit | 20424c4ad7166a9683de812cab5eed6f8f3425fc (patch) | |
tree | 77fb1bbc0133e92e374112f9fc33dc87ea69a097 /src/main/java/com/google/devtools/build/lib/util | |
parent | 8594de82e367fb463f2d02d3adda25fc99de9a9f (diff) |
Make the spell checker a bit more conservative.
Reduce the max spell-checking distance for matching words.
"target" will not match "range" anymore.
--
PiperOrigin-RevId: 150638073
MOS_MIGRATED_REVID=150638073
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/util')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/util/SpellChecker.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/util/SpellChecker.java b/src/main/java/com/google/devtools/build/lib/util/SpellChecker.java index 2671a90590..ba3ae189be 100644 --- a/src/main/java/com/google/devtools/build/lib/util/SpellChecker.java +++ b/src/main/java/com/google/devtools/build/lib/util/SpellChecker.java @@ -83,7 +83,7 @@ public final class SpellChecker { public static String suggest(String input, Iterable<String> words) { String best = null; // Heuristic: the expected number of typos depends on the length of the word. - int bestDistance = Math.min(5, input.length() / 2 + 1); + int bestDistance = Math.min(5, (input.length() + 1) / 2); input = input.toLowerCase(); for (String candidate : words) { int d = editDistance(input, candidate.toLowerCase(), bestDistance); |