public class FuzzySearch extends Object
| Constructor | Description |
|---|---|
FuzzySearch() |
| Modifier and Type | Method | 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,
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,
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 <T> List<BoundExtractedResult<T>> |
extractAll(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction) |
Creates a list of
ExtractedResult which contain all the choices with
their corresponding score where higher is more similar |
static <T> List<BoundExtractedResult<T>> |
extractAll(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction,
int cutoff) |
Creates a list of
ExtractedResult which contain all the choices with
their corresponding score where higher is more similar |
static <T> List<BoundExtractedResult<T>> |
extractAll(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction,
Applicable func) |
Creates a list of
ExtractedResult which contain all the choices with
their corresponding score where higher is more similar |
static <T> List<BoundExtractedResult<T>> |
extractAll(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction,
Applicable func,
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 <T> BoundExtractedResult<T> |
extractOne(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction) |
Find the single best match above a score in a list of choices.
|
static <T> BoundExtractedResult<T> |
extractOne(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction,
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,
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,
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 <T> List<BoundExtractedResult<T>> |
extractSorted(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction) |
Creates a sorted list of
ExtractedResult which contain all the choices
with their corresponding score where higher is more similar |
static <T> List<BoundExtractedResult<T>> |
extractSorted(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction,
int cutoff) |
Creates a sorted list of
ExtractedResult which contain all the choices
with their corresponding score where higher is more similar |
static <T> List<BoundExtractedResult<T>> |
extractSorted(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction,
Applicable func) |
Creates a sorted list of
ExtractedResult which contain all the choices
with their corresponding score where higher is more similar |
static <T> List<BoundExtractedResult<T>> |
extractSorted(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction,
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> |
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 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 <T> List<BoundExtractedResult<T>> |
extractTop(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction,
int limit) |
Creates a sorted list of
ExtractedResult which contain the
top @param limit most similar choices |
static <T> List<BoundExtractedResult<T>> |
extractTop(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction,
int limit,
int cutoff) |
Creates a sorted list of
ExtractedResult which contain the
top @param limit most similar choices |
static <T> List<BoundExtractedResult<T>> |
extractTop(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction,
Applicable func,
int limit) |
Creates a sorted list of
ExtractedResult which contain the
top @param limit most similar choices |
static <T> List<BoundExtractedResult<T>> |
extractTop(String query,
Collection<T> choices,
ToStringFunction<T> toStringFunction,
Applicable func,
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,
ToStringFunction<String> stringFunction) |
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,
ToStringFunction<String> stringFunction) |
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,
ToStringFunction<String> stringFunction) |
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,
ToStringFunction<String> stringFunction) |
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,
ToStringFunction<String> stringFunction) |
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,
ToStringFunction<String> stringFunction) |
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,
ToStringFunction<String> stringFunction) |
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, ToStringFunction<String> stringFunction)
s1 - Input strings2 - Input stringstringFunction - 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, ToStringFunction<String> stringFunction)
s1 - Input strings2 - Input stringstringFunction - 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, ToStringFunction<String> stringFunction)
s1 - Input strings2 - Input stringstringFunction - 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, ToStringFunction<String> stringFunction)
s1 - Input strings2 - Input stringstringFunction - 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, ToStringFunction<String> stringFunction)
s1 - Input strings2 - Input stringstringFunction - 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, ToStringFunction<String> stringFunction)
s1 - Input strings2 - Input stringstringFunction - 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, ToStringFunction<String> stringFunction)
s1 - Input strings2 - Input stringstringFunction - 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 choicespublic static <T> List<BoundExtractedResult<T>> extractTop(String query, Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func, int limit, int cutoff)
ExtractedResult which contain the
top @param limit most similar choicesquery - The query stringchoices - A list of choicestoStringFunction - The ToStringFunction to be applied to all choices.func - The scoring functionpublic static <T> List<BoundExtractedResult<T>> extractTop(String query, Collection<T> choices, ToStringFunction<T> toStringFunction, int limit, int cutoff)
ExtractedResult which contain the
top @param limit most similar choicesquery - The query stringchoices - A list of choicestoStringFunction - The ToStringFunction to be applied to all choices.limit - Limits the number of results and speeds up
the search (k-top heap sort) is usedcutoff - Rejects any entries with score below thispublic static <T> List<BoundExtractedResult<T>> extractTop(String query, Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func, int limit)
ExtractedResult which contain the
top @param limit most similar choicesquery - The query stringchoices - A list of choicestoStringFunction - The ToStringFunction to be applied to all choices.func - The scoring functionlimit - The number of results to returnpublic static <T> List<BoundExtractedResult<T>> extractTop(String query, Collection<T> choices, ToStringFunction<T> toStringFunction, int limit)
ExtractedResult which contain the
top @param limit most similar choicesquery - The query stringchoices - A list of choicestoStringFunction - The ToStringFunction to be applied to all choices.limit - The number of results to returnpublic static <T> List<BoundExtractedResult<T>> extractSorted(String query, Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func)
ExtractedResult which contain all the choices
with their corresponding score where higher is more similarquery - The query stringchoices - A list of choicestoStringFunction - The ToStringFunction to be applied to all choices.func - The scoring functionpublic static <T> List<BoundExtractedResult<T>> extractSorted(String query, Collection<T> choices, ToStringFunction<T> toStringFunction, 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 choicestoStringFunction - The ToStringFunction to be applied to all choices.func - The scoring functioncutoff - Keep only scores above cutoffpublic static <T> List<BoundExtractedResult<T>> extractSorted(String query, Collection<T> choices, ToStringFunction<T> toStringFunction)
ExtractedResult which contain all the choices
with their corresponding score where higher is more similarquery - The query stringchoices - A list of choicestoStringFunction - The ToStringFunction to be applied to all choices.public static <T> List<BoundExtractedResult<T>> extractSorted(String query, Collection<T> choices, ToStringFunction<T> toStringFunction, int cutoff)
ExtractedResult which contain all the choices
with their corresponding score where higher is more similarquery - The query stringchoices - A list of choicestoStringFunction - The ToStringFunction to be applied to all choices.cutoff - Keep only scores above cutoffpublic static <T> List<BoundExtractedResult<T>> extractAll(String query, Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func)
ExtractedResult which contain all the choices with
their corresponding score where higher is more similarquery - The query stringchoices - A list of choicestoStringFunction - The ToStringFunction to be applied to all choices.func - The scoring functionpublic static <T> List<BoundExtractedResult<T>> extractAll(String query, Collection<T> choices, ToStringFunction<T> toStringFunction, 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 choicestoStringFunction - The ToStringFunction to be applied to all choices.func - The scoring functioncutoff - Keep only scores above cutoffpublic static <T> List<BoundExtractedResult<T>> extractAll(String query, Collection<T> choices, ToStringFunction<T> toStringFunction)
ExtractedResult which contain all the choices with
their corresponding score where higher is more similarquery - The query stringchoices - A list of choicestoStringFunction - The ToStringFunction to be applied to all choices.public static <T> List<BoundExtractedResult<T>> extractAll(String query, Collection<T> choices, ToStringFunction<T> toStringFunction, int cutoff)
ExtractedResult which contain all the choices with
their corresponding score where higher is more similarquery - The query stringchoices - A list of choicestoStringFunction - The ToStringFunction to be applied to all choices.cutoff - Keep only scores above cutoffpublic static <T> BoundExtractedResult<T> extractOne(String query, Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func)
query - A string to match againstchoices - A list of choicestoStringFunction - The ToStringFunction to be applied to all choices.func - Scoring functionpublic static <T> BoundExtractedResult<T> extractOne(String query, Collection<T> choices, ToStringFunction<T> toStringFunction)
query - A string to match againstchoices - A list of choicestoStringFunction - The ToStringFunction to be applied to all choices.Copyright © 2018. All rights reserved.