Class EditDistance

java.lang.Object
org.ek9lang.compiler.support.EditDistance

public final class EditDistance extends Object
THE edit distance behind the compiler's "did you mean" hints for a misspelt WORD - a keyword (repair/ParseSuggestions) or a package property name (PackageProperties): optimal string alignment, where an insertion, a removal, a change and a transposition of adjacent characters (esle, verison) each count one. Use this - do not write another copy.

Deliberately not org.ek9.lang.Levenshtein.costOfMatch (the runtime's fuzzy match, which weighs a leading insertion differently) nor E11030's own weighted distance (phase5/ConfusinglySimilarNamesOrError), which answers a different question: are two names a reader could confuse.

  • Method Details

    • of

      public static int of(String a, String b)
      The optimal-string-alignment distance between a and b, case-sensitive.