|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.evanmclean.evlib.text.FuzzyCompare
public class FuzzyCompare
Performs a fuzzy comparison between two strings to try and find similar strings.
Note: This class needs a recent version of Apache Commons Lang library.
The algorithm is roughly:
All comparisons are case insensitive (mainly by converting the lexicon to all lower case).
| Constructor Summary | |
|---|---|
FuzzyCompare()
Construct a new fuzzy comparator with the default ignored words and minimum word length. |
|
FuzzyCompare(Collection<String> ignored_words)
Construct a new fuzzy comparator with the default minimum word length. |
|
FuzzyCompare(Collection<String> ignored_words,
int min_word_length)
Construct a new fuzzy comparator. |
|
FuzzyCompare(int min_word_length)
Construct a new fuzzy comparator with the default ignored words. |
|
FuzzyCompare(String lhs)
Construct a new fuzzy comparator with the default ignored words and minimum word length. |
|
FuzzyCompare(String lhs,
Collection<String> ignored_words)
Construct a new fuzzy comparator with the default minimum word length. |
|
FuzzyCompare(String lhs,
Collection<String> ignored_words,
int min_word_length)
Construct a new fuzzy comparator. |
|
FuzzyCompare(String lhs,
int min_word_length)
Construct a new fuzzy comparator with the default ignored words. |
|
| Method Summary | |
|---|---|
void |
addIgnoredWords(Collection<String> ignored_words)
Add the additional collection of words to the ignored words list. |
void |
addIgnoredWords(String... ignored_words)
Add the additional collection of words to the ignored words list. |
double |
difference(String rhs)
Perform the difference comparison against the specified string. |
double |
difference(String lhs,
String rhs)
Perform the difference comparison against the two strings. |
String[] |
getIgnoredWords()
Returns the current set of ignored words. |
int |
getMinimumWordLength()
The current minimum word length (default of 3). |
FuzzyLexicon |
makeLexicon(String str)
Construct a lexicon of all the good words in the string. |
void |
setIgnoredWords(Collection<String> ignored_words)
Set the ignored word set to the specified collection. |
void |
setLeft(String lhs)
Set the left side to be compared. |
void |
setMinimumWordLength(int minimumWordLength)
Set the minimum word length that will be used. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FuzzyCompare()
getMinimumWordLength()public FuzzyCompare(Collection<String> ignored_words)
ignored_words - The set of words to be ignored.getMinimumWordLength()
public FuzzyCompare(Collection<String> ignored_words,
int min_word_length)
ignored_words - The set of words to be ignored.min_word_length - Ignore words that are smaller than this length.getMinimumWordLength()public FuzzyCompare(int min_word_length)
min_word_length - Ignore words that are smaller than this length.getMinimumWordLength()public FuzzyCompare(String lhs)
lhs - The left string to compare.getMinimumWordLength()
public FuzzyCompare(String lhs,
Collection<String> ignored_words)
lhs - The left string to compare.ignored_words - The set of words to be ignored.getMinimumWordLength()
public FuzzyCompare(String lhs,
Collection<String> ignored_words,
int min_word_length)
lhs - The left string to compare.ignored_words - The set of words to be ignored.min_word_length - Ignore words that are smaller than this length.
public FuzzyCompare(String lhs,
int min_word_length)
lhs - The left string to compare.min_word_length - Ignore words that are smaller than this length.| Method Detail |
|---|
public void addIgnoredWords(Collection<String> ignored_words)
ignored_words - public void addIgnoredWords(String... ignored_words)
ignored_words - public double difference(String rhs)
set.
rhs - The string to compare against.
difference(String, String),
setLeft(String)
public double difference(String lhs,
String rhs)
comparisons.
lhs - The left string to compare.rhs - The right string to compare.
difference(String),
setLeft(String)public String[] getIgnoredWords()
public int getMinimumWordLength()
public FuzzyLexicon makeLexicon(String str)
str - The string to process.
public void setIgnoredWords(Collection<String> ignored_words)
ignored_words - public void setLeft(String lhs)
lhs - The string to be compared.difference(String),
difference(String, String)public void setMinimumWordLength(int minimumWordLength)
minimumWordLength -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||