com.espertech.esper.util
Class LevenshteinDistance

java.lang.Object
  extended by com.espertech.esper.util.LevenshteinDistance

public class LevenshteinDistance
extends java.lang.Object

Utility for string comparison based on the Levenshtein algo.


Field Summary
static int ACCEPTABLE_DISTANCE
          Make 3 characters an acceptable distance for reporting.
 
Constructor Summary
LevenshteinDistance()
           
 
Method Summary
static int computeLevenshteinDistance(java.lang.CharSequence str1, java.lang.CharSequence str2)
          Compute the distance between two strins using the Levenshtein algorithm, including a case-insensitive string comparison.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCEPTABLE_DISTANCE

public static final int ACCEPTABLE_DISTANCE
Make 3 characters an acceptable distance for reporting.

See Also:
Constant Field Values
Constructor Detail

LevenshteinDistance

public LevenshteinDistance()
Method Detail

computeLevenshteinDistance

public static int computeLevenshteinDistance(java.lang.CharSequence str1,
                                             java.lang.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.

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com