org.basex.util
Class Levenshtein
java.lang.Object
org.basex.util.Levenshtein
public final class Levenshtein
- extends java.lang.Object
Damerau-Levenshtein implementation. Based on the publications from
Levenshtein (1965): Binary codes capable of correcting spurious insertions
and deletions of ones, and Damerau (1964): A technique for computer
detection and correction of spelling errors.
- Author:
- BaseX Team 2005-12, BSD License, Christian Gruen
Method Summary |
boolean |
similar(byte[] token,
byte[] sub)
Compares two character arrays for similarity. |
boolean |
similar(byte[] token,
byte[] sub,
int err)
Compares two character arrays for similarity. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Levenshtein
public Levenshtein()
similar
public boolean similar(byte[] token,
byte[] sub)
- Compares two character arrays for similarity.
- Parameters:
token
- token to be comparedsub
- second token to be compared
- Returns:
- true if the arrays are similar
similar
public boolean similar(byte[] token,
byte[] sub,
int err)
- Compares two character arrays for similarity.
- Parameters:
token
- token to be comparedsub
- second token to be comparederr
- number of allowed errors; dynamic calculation if value is 0
- Returns:
- true if the arrays are similar