MCPcopy Index your code
hub / github.com/antlr/codebuff / normalizedLevenshteinDistance

Method normalizedLevenshteinDistance

src/org/antlr/codebuff/Dbg.java:113–117  ·  view source on GitHub ↗

from https://en.wikipedia.org/wiki/Levenshtein_distance "It is always at least the difference of the sizes of the two strings." "It is at most the length of the longer string."

(String s, String t)

Source from the content-addressed store, hash-verified

111 * "It is at most the length of the longer string."
112 */
113 public static float normalizedLevenshteinDistance(String s, String t) {
114 float d = levenshteinDistance(s, t);
115 int max = Math.max(s.length(), t.length());
116 return d / (float)max;
117 }
118
119 public static float levenshteinDistance(String s, String t) {
120 // degenerate cases

Callers 7

mainMethod · 0.95
getWSEditDistanceMethod · 0.80
validateMethod · 0.80
checkStabilityMethod · 0.80
mainMethod · 0.80
validateMethod · 0.80

Calls 3

levenshteinDistanceMethod · 0.95
maxMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected