Class LevenshteinDistance

java.lang.Object
com.espertech.esper.common.internal.util.LevenshteinDistance

public class LevenshteinDistance extends Object
Utility for string comparison based on the Levenshtein algo.
  • Field Details

    • ACCEPTABLE_DISTANCE

      public static final int ACCEPTABLE_DISTANCE
      Make 3 characters an acceptable distance for reporting.
      See Also:
  • Constructor Details

    • LevenshteinDistance

      public LevenshteinDistance()
  • Method Details

    • computeLevenshteinDistance

      public static int computeLevenshteinDistance(CharSequence str1, CharSequence str2)
      Compute the distance between two strins using the Levenshtein algorithm, including a case-insensitive string comparison.
      Parameters:
      str1 - first string
      str2 - second string
      Returns:
      distance or zero if case-insensitive string comparison found equal strings or Integer.MAX_VALUE for invalid comparison because of null values.