|
Email Answering System Version 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ninecode.email.util.Levenshtein
Computes the Levenshtein distance (string-to-string edit). From: Finding String Distances by Ray Valdes Dr. Dobbs Journal, April 1992
Field Summary | |
protected static int |
DEL
Indicates the character is deleted. |
protected static int |
INS
Indicates the character is inserted. |
protected static int |
MATCH
Indicates the characters match. |
protected com.ninecode.email.util.Levenshtein.MatrixCell[][] |
mMatrix
This is the matrix. |
protected com.ninecode.email.util.Levenshtein.Operation[] |
mOperationTable
Costs defined on a per-op basis. |
protected String |
mString1
One string. |
protected int |
mString1Length
One string length. |
protected char[] |
mString1Shadow
One string as characters. |
protected String |
mString2
The other string. |
protected int |
mString2Length
The other string length. |
protected char[] |
mString2Shadow
The other string as characters. |
protected static int |
SUB
Indicates one character is substituted for another. |
protected static boolean |
verbose_mode
Debugging flag. |
Constructor Summary | |
Levenshtein()
Create a Levenshtein distance calculation object. |
|
Levenshtein(int size)
Create a Levenshtein distance calculation object. |
Method Summary | |
protected void |
calculateMatrix()
Calculate the Levenshtein distance. |
int |
getDistance()
Get the Levenshtein distance. |
protected int |
getDistance(int i,
int j)
Get the cost at a particular element in the matrix. |
String |
getString1()
Get the current string being used. |
String |
getString2()
Get the current string being used. |
protected void |
initialize(int size)
Create memory structures. |
void |
setString1(String string)
Setup one string value. |
void |
setString2(String string)
Setup the other string value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected com.ninecode.email.util.Levenshtein.Operation[] mOperationTable
protected static final int MATCH
protected static final int INS
protected static final int DEL
protected static final int SUB
protected com.ninecode.email.util.Levenshtein.MatrixCell[][] mMatrix
protected String mString1
protected String mString2
protected int mString1Length
protected int mString2Length
protected char[] mString1Shadow
protected char[] mString2Shadow
protected static final boolean verbose_mode
Constructor Detail |
public Levenshtein()
public Levenshtein(int size)
size
- The initial maximum string size.Method Detail |
protected void initialize(int size)
size
- The size of the matrix/character arrays to make.public void setString1(String string)
string
- The string to calculate with.public String getString1()
public void setString2(String string)
string
- The string to calculate with.public String getString2()
protected void calculateMatrix()
protected int getDistance(int i, int j)
i
- The row to get the distance for.j
- The column to get the distance for.
public int getDistance()
|
Email Answering System Version 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |