public class FuzzySearch extends Object
| Constructor and Description |
|---|
FuzzySearch() |
| Modifier and Type | Method and Description |
|---|---|
static List<ExtractedResult> |
extractAll(String query,
Collection<String> choices)
Creates a list of
ExtractedResult which contain all the choices with
their corresponding score where higher is more similar |
static List<ExtractedResult> |
extractAll(String query,
Collection<String> choices,
Applicable func)
Creates a list of
ExtractedResult which contain all the choices with
their corresponding score where higher is more similar |
static List<ExtractedResult> |
extractAll(String query,
Collection<String> choices,
Applicable func,
int cutoff)
Creates a list of
ExtractedResult which contain all the choices with
their corresponding score where higher is more similar |
static List<ExtractedResult> |
extractAll(String query,
Collection<String> choices,
int cutoff)
Creates a list of
ExtractedResult which contain all the choices with
their corresponding score where higher is more similar |
static ExtractedResult |
extractOne(String query,
Collection<String> choices)
Find the single best match above a score in a list of choices.
|
static ExtractedResult |
extractOne(String query,
Collection<String> choices,
Applicable func)
Find the single best match above a score in a list of choices.
|
static List<ExtractedResult> |
extractSorted(String query,
Collection<String> choices)
Creates a sorted list of
ExtractedResult which contain all the choices
with their corresponding score where higher is more similar |
static List<ExtractedResult> |
extractSorted(String query,
Collection<String> choices,
Applicable func)
Creates a sorted list of
ExtractedResult which contain all the choices
with their corresponding score where higher is more similar |
static List<ExtractedResult> |
extractSorted(String query,
Collection<String> choices,
Applicable func,
int cutoff)
Creates a sorted list of
ExtractedResult which contain all the choices
with their corresponding score where higher is more similar |
static List<ExtractedResult> |
extractSorted(String query,
Collection<String> choices,
int cutoff)
Creates a sorted list of
ExtractedResult which contain all the choices
with their corresponding score where higher is more similar |
static List<ExtractedResult> |
extractTop(String query,
Collection<String> choices,
Applicable func,
int limit)
Creates a sorted list of
ExtractedResult which contain the
top @param limit most similar choices |
static List<ExtractedResult> |
extractTop(String query,
Collection<String> choices,
Applicable func,
int limit,
int cutoff)
Creates a sorted list of
ExtractedResult which contain the
top @param limit most similar choices |
static List<ExtractedResult> |
extractTop(String query,
Collection<String> choices,
int limit)
Creates a sorted list of
ExtractedResult which contain the
top @param limit most similar choices |
static List<ExtractedResult> |
extractTop(String query,
Collection<String> choices,
int limit,
int cutoff)
Creates a sorted list of
ExtractedResult which contain the
top @param limit most similar choices |
static int |
partialRatio(String s1,
String s2)
Inconsistent substrings lead to problems in matching.
|
static int |
partialRatio(String s1,
String s2,
StringProcessor stringProcessor)
Inconsistent substrings lead to problems in matching.
|
static int |
ratio(String s1,
String s2)
Calculates a Levenshtein simple ratio between the strings.
|
static int |
ratio(String s1,
String s2,
StringProcessor stringProcessor)
Calculates a Levenshtein simple ratio between the strings.
|
static int |
tokenSetPartialRatio(String s1,
String s2)
Splits the strings into tokens and computes intersections and remainders
between the tokens of the two strings.
|
static int |
tokenSetPartialRatio(String s1,
String s2,
StringProcessor stringProcessor)
Splits the strings into tokens and computes intersections and remainders
between the tokens of the two strings.
|
static int |
tokenSetRatio(String s1,
String s2)
Splits the strings into tokens and computes intersections and remainders
between the tokens of the two strings.
|
static int |
tokenSetRatio(String s1,
String s2,
StringProcessor stringProcessor)
Splits the strings into tokens and computes intersections and remainders
between the tokens of the two strings.
|
static int |
tokenSortPartialRatio(String s1,
String s2)
Find all alphanumeric tokens in the string and sort
those tokens and then take ratio of resulting
joined strings.
|
static int |
tokenSortPartialRatio(String s1,
String s2,
StringProcessor stringProcessor)
Find all alphanumeric tokens in the string and sort
those tokens and then take ratio of resulting
joined strings.
|
static int |
tokenSortRatio(String s1,
String s2)
Find all alphanumeric tokens in the string and sort
those tokens and then take ratio of resulting
joined strings.
|
static int |
tokenSortRatio(String s1,
String s2,
StringProcessor stringProcessor)
Find all alphanumeric tokens in the string and sort
those tokens and then take ratio of resulting
joined strings.
|
static int |
weightedRatio(String s1,
String s2)
Calculates a weighted ratio between the different algorithms for best results
|
static int |
weightedRatio(String s1,
String s2,
StringProcessor stringProcessor)
Calculates a weighted ratio between the different algorithms for best results
|
public static int ratio(String s1, String s2)
s1 - Input strings2 - Input stringpublic static int ratio(String s1, String s2, StringProcessor stringProcessor)
s1 - Input strings2 - Input stringstringProcessor - Functor which transforms strings before
calculating the ratiopublic static int partialRatio(String s1, String s2)
s1 - Input strings2 - Input stringpublic static int partialRatio(String s1, String s2, StringProcessor stringProcessor)
s1 - Input strings2 - Input stringstringProcessor - Functor which transforms strings before
calculating the ratiopublic static int tokenSortPartialRatio(String s1, String s2)
s1 - Input strings2 - Input stringpublic static int tokenSortPartialRatio(String s1, String s2, StringProcessor stringProcessor)
s1 - Input strings2 - Input stringstringProcessor - Functor which transforms strings before
calculating the ratiopublic static int tokenSortRatio(String s1, String s2)
s1 - Input strings2 - Input stringpublic static int tokenSortRatio(String s1, String s2, StringProcessor stringProcessor)
s1 - Input strings2 - Input stringstringProcessor - Functor which transforms strings before
calculating the ratiopublic static int tokenSetRatio(String s1, String s2)
s1 - Input strings2 - Input stringpublic static int tokenSetRatio(String s1, String s2, StringProcessor stringProcessor)
s1 - Input strings2 - Input stringstringProcessor - Functor which transforms strings before
calculating the ratiopublic static int tokenSetPartialRatio(String s1, String s2)
s1 - Input strings2 - Input stringpublic static int tokenSetPartialRatio(String s1, String s2, StringProcessor stringProcessor)
s1 - Input strings2 - Input stringstringProcessor - Functor which transforms strings before
calculating the ratiopublic static int weightedRatio(String s1, String s2)
s1 - Input strings2 - Input stringpublic static int weightedRatio(String s1, String s2, StringProcessor stringProcessor)
s1 - Input strings2 - Input stringstringProcessor - Functor which transforms strings before
calculating the ratiopublic static List<ExtractedResult> extractTop(String query, Collection<String> choices, Applicable func, int limit, int cutoff)
ExtractedResult which contain the
top @param limit most similar choicesquery - The query stringchoices - A list of choicesfunc - The scoring functionpublic static List<ExtractedResult> extractTop(String query, Collection<String> choices, int limit, int cutoff)
ExtractedResult which contain the
top @param limit most similar choicesquery - The query stringchoices - A list of choiceslimit - Limits the number of results and speeds up
the search (k-top heap sort) is usedcutoff - Rejects any entries with score below thispublic static List<ExtractedResult> extractTop(String query, Collection<String> choices, Applicable func, int limit)
ExtractedResult which contain the
top @param limit most similar choicesquery - The query stringchoices - A list of choicesfunc - The scoring functionlimit - The number of results to returnpublic static List<ExtractedResult> extractTop(String query, Collection<String> choices, int limit)
ExtractedResult which contain the
top @param limit most similar choicesquery - The query stringchoices - A list of choiceslimit - The number of results to returnpublic static List<ExtractedResult> extractSorted(String query, Collection<String> choices, Applicable func)
ExtractedResult which contain all the choices
with their corresponding score where higher is more similarquery - The query stringchoices - A list of choicesfunc - The scoring functionpublic static List<ExtractedResult> extractSorted(String query, Collection<String> choices, Applicable func, int cutoff)
ExtractedResult which contain all the choices
with their corresponding score where higher is more similarquery - The query stringchoices - A list of choicesfunc - The scoring functioncutoff - Keep only scores above cutoffpublic static List<ExtractedResult> extractSorted(String query, Collection<String> choices)
ExtractedResult which contain all the choices
with their corresponding score where higher is more similarquery - The query stringchoices - A list of choicespublic static List<ExtractedResult> extractSorted(String query, Collection<String> choices, int cutoff)
ExtractedResult which contain all the choices
with their corresponding score where higher is more similarquery - The query stringchoices - A list of choicescutoff - Keep only scores above cutoffpublic static List<ExtractedResult> extractAll(String query, Collection<String> choices, Applicable func)
ExtractedResult which contain all the choices with
their corresponding score where higher is more similarquery - The query stringchoices - A list of choicesfunc - The scoring functionpublic static List<ExtractedResult> extractAll(String query, Collection<String> choices, Applicable func, int cutoff)
ExtractedResult which contain all the choices with
their corresponding score where higher is more similarquery - The query stringchoices - A list of choicesfunc - The scoring functioncutoff - Keep only scores above cutoffpublic static List<ExtractedResult> extractAll(String query, Collection<String> choices)
ExtractedResult which contain all the choices with
their corresponding score where higher is more similarquery - The query stringchoices - A list of choicespublic static List<ExtractedResult> extractAll(String query, Collection<String> choices, int cutoff)
ExtractedResult which contain all the choices with
their corresponding score where higher is more similarquery - The query stringchoices - A list of choicescutoff - Keep only scores above cutoffpublic static ExtractedResult extractOne(String query, Collection<String> choices, Applicable func)
query - A string to match againstchoices - A list of choicesfunc - Scoring functionpublic static ExtractedResult extractOne(String query, Collection<String> choices)
query - A string to match againstchoices - A list of choicesCopyright © 2018. All rights reserved.