Package me.xdrop.fuzzywuzzy
Class FuzzySearch
- java.lang.Object
-
- me.xdrop.fuzzywuzzy.FuzzySearch
-
public class FuzzySearch extends java.lang.ObjectFuzzySearch facade class
-
-
Constructor Summary
Constructors Constructor Description FuzzySearch()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<ExtractedResult>extractAll(java.lang.String query, java.util.Collection<java.lang.String> choices)Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic java.util.List<ExtractedResult>extractAll(java.lang.String query, java.util.Collection<java.lang.String> choices, int cutoff)Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic java.util.List<ExtractedResult>extractAll(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func)Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic java.util.List<ExtractedResult>extractAll(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func, int cutoff)Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic <T> java.util.List<BoundExtractedResult<T>>extractAll(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction)Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic <T> java.util.List<BoundExtractedResult<T>>extractAll(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, int cutoff)Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic <T> java.util.List<BoundExtractedResult<T>>extractAll(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func)Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic <T> java.util.List<BoundExtractedResult<T>>extractAll(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func, int cutoff)Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic ExtractedResultextractOne(java.lang.String query, java.util.Collection<java.lang.String> choices)Find the single best match above a score in a list of choices.static ExtractedResultextractOne(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func)Find the single best match above a score in a list of choices.static <T> BoundExtractedResult<T>extractOne(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction)Find the single best match above a score in a list of choices.static <T> BoundExtractedResult<T>extractOne(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func)Find the single best match above a score in a list of choices.static java.util.List<ExtractedResult>extractSorted(java.lang.String query, java.util.Collection<java.lang.String> choices)Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic java.util.List<ExtractedResult>extractSorted(java.lang.String query, java.util.Collection<java.lang.String> choices, int cutoff)Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic java.util.List<ExtractedResult>extractSorted(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func)Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic java.util.List<ExtractedResult>extractSorted(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func, int cutoff)Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic <T> java.util.List<BoundExtractedResult<T>>extractSorted(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction)Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic <T> java.util.List<BoundExtractedResult<T>>extractSorted(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, int cutoff)Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic <T> java.util.List<BoundExtractedResult<T>>extractSorted(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func)Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic <T> java.util.List<BoundExtractedResult<T>>extractSorted(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func, int cutoff)Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similarstatic java.util.List<ExtractedResult>extractTop(java.lang.String query, java.util.Collection<java.lang.String> choices, int limit)Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choicesstatic java.util.List<ExtractedResult>extractTop(java.lang.String query, java.util.Collection<java.lang.String> choices, int limit, int cutoff)Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choicesstatic java.util.List<ExtractedResult>extractTop(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func, int limit)Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choicesstatic java.util.List<ExtractedResult>extractTop(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func, int limit, int cutoff)Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choicesstatic <T> java.util.List<BoundExtractedResult<T>>extractTop(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, int limit)Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choicesstatic <T> java.util.List<BoundExtractedResult<T>>extractTop(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, int limit, int cutoff)Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choicesstatic <T> java.util.List<BoundExtractedResult<T>>extractTop(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func, int limit)Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choicesstatic <T> java.util.List<BoundExtractedResult<T>>extractTop(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func, int limit, int cutoff)Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choicesstatic intpartialRatio(java.lang.String s1, java.lang.String s2)Inconsistent substrings lead to problems in matching.static intpartialRatio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Inconsistent substrings lead to problems in matching.static intratio(java.lang.String s1, java.lang.String s2)Calculates a Levenshtein simple ratio between the strings.static intratio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Calculates a Levenshtein simple ratio between the strings.static inttokenSetPartialRatio(java.lang.String s1, java.lang.String s2)Splits the strings into tokens and computes intersections and remainders between the tokens of the two strings.static inttokenSetPartialRatio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Splits the strings into tokens and computes intersections and remainders between the tokens of the two strings.static inttokenSetRatio(java.lang.String s1, java.lang.String s2)Splits the strings into tokens and computes intersections and remainders between the tokens of the two strings.static inttokenSetRatio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Splits the strings into tokens and computes intersections and remainders between the tokens of the two strings.static inttokenSortPartialRatio(java.lang.String s1, java.lang.String s2)Find all alphanumeric tokens in the string and sort those tokens and then take ratio of resulting joined strings.static inttokenSortPartialRatio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Find all alphanumeric tokens in the string and sort those tokens and then take ratio of resulting joined strings.static inttokenSortRatio(java.lang.String s1, java.lang.String s2)Find all alphanumeric tokens in the string and sort those tokens and then take ratio of resulting joined strings.static inttokenSortRatio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Find all alphanumeric tokens in the string and sort those tokens and then take ratio of resulting joined strings.static intweightedRatio(java.lang.String s1, java.lang.String s2)Calculates a weighted ratio between the different algorithms for best resultsstatic intweightedRatio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Calculates a weighted ratio between the different algorithms for best results
-
-
-
Method Detail
-
ratio
public static int ratio(java.lang.String s1, java.lang.String s2)Calculates a Levenshtein simple ratio between the strings. This is indicates a measure of similarity- Parameters:
s1- Input strings2- Input string- Returns:
- The simple ratio
-
ratio
public static int ratio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Calculates a Levenshtein simple ratio between the strings. This is indicates a measure of similarity- Parameters:
s1- Input strings2- Input stringstringFunction- Functor which transforms strings before calculating the ratio- Returns:
- The simple ratio
-
partialRatio
public static int partialRatio(java.lang.String s1, java.lang.String s2)Inconsistent substrings lead to problems in matching. This ratio uses a heuristic called "best partial" for when two strings are of noticeably different lengths.- Parameters:
s1- Input strings2- Input string- Returns:
- The partial ratio
-
partialRatio
public static int partialRatio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Inconsistent substrings lead to problems in matching. This ratio uses a heuristic called "best partial" for when two strings are of noticeably different lengths.- Parameters:
s1- Input strings2- Input stringstringFunction- Functor which transforms strings before calculating the ratio- Returns:
- The partial ratio
-
tokenSortPartialRatio
public static int tokenSortPartialRatio(java.lang.String s1, java.lang.String s2)Find all alphanumeric tokens in the string and sort those tokens and then take ratio of resulting joined strings.- Parameters:
s1- Input strings2- Input string- Returns:
- The partial ratio of the strings
-
tokenSortPartialRatio
public static int tokenSortPartialRatio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Find all alphanumeric tokens in the string and sort those tokens and then take ratio of resulting joined strings.- Parameters:
s1- Input strings2- Input stringstringFunction- Functor which transforms strings before calculating the ratio- Returns:
- The partial ratio of the strings
-
tokenSortRatio
public static int tokenSortRatio(java.lang.String s1, java.lang.String s2)Find all alphanumeric tokens in the string and sort those tokens and then take ratio of resulting joined strings.- Parameters:
s1- Input strings2- Input string- Returns:
- The full ratio of the strings
-
tokenSortRatio
public static int tokenSortRatio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Find all alphanumeric tokens in the string and sort those tokens and then take ratio of resulting joined strings.- Parameters:
s1- Input strings2- Input stringstringFunction- Functor which transforms strings before calculating the ratio- Returns:
- The full ratio of the strings
-
tokenSetRatio
public static int tokenSetRatio(java.lang.String s1, java.lang.String s2)Splits the strings into tokens and computes intersections and remainders between the tokens of the two strings. A comparison string is then built up and is compared using the simple ratio algorithm. Useful for strings where words appear redundantly.- Parameters:
s1- Input strings2- Input string- Returns:
- The ratio of similarity
-
tokenSetRatio
public static int tokenSetRatio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Splits the strings into tokens and computes intersections and remainders between the tokens of the two strings. A comparison string is then built up and is compared using the simple ratio algorithm. Useful for strings where words appear redundantly.- Parameters:
s1- Input strings2- Input stringstringFunction- Functor which transforms strings before calculating the ratio- Returns:
- The ratio of similarity
-
tokenSetPartialRatio
public static int tokenSetPartialRatio(java.lang.String s1, java.lang.String s2)Splits the strings into tokens and computes intersections and remainders between the tokens of the two strings. A comparison string is then built up and is compared using the simple ratio algorithm. Useful for strings where words appear redundantly.- Parameters:
s1- Input strings2- Input string- Returns:
- The ratio of similarity
-
tokenSetPartialRatio
public static int tokenSetPartialRatio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Splits the strings into tokens and computes intersections and remainders between the tokens of the two strings. A comparison string is then built up and is compared using the simple ratio algorithm. Useful for strings where words appear redundantly.- Parameters:
s1- Input strings2- Input stringstringFunction- Functor which transforms strings before calculating the ratio- Returns:
- The ratio of similarity
-
weightedRatio
public static int weightedRatio(java.lang.String s1, java.lang.String s2)Calculates a weighted ratio between the different algorithms for best results- Parameters:
s1- Input strings2- Input string- Returns:
- The ratio of similarity
-
weightedRatio
public static int weightedRatio(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)Calculates a weighted ratio between the different algorithms for best results- Parameters:
s1- Input strings2- Input stringstringFunction- Functor which transforms strings before calculating the ratio- Returns:
- The ratio of similarity
-
extractTop
public static java.util.List<ExtractedResult> extractTop(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func, int limit, int cutoff)
Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choices- Parameters:
query- The query stringchoices- A list of choicesfunc- The scoring function- Returns:
- A list of the results
-
extractTop
public static java.util.List<ExtractedResult> extractTop(java.lang.String query, java.util.Collection<java.lang.String> choices, int limit, int cutoff)
Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choices- Parameters:
query- 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 this- Returns:
- A list of the results
-
extractTop
public static java.util.List<ExtractedResult> extractTop(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func, int limit)
Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choices- Parameters:
query- The query stringchoices- A list of choicesfunc- The scoring functionlimit- The number of results to return- Returns:
- A list of the results
-
extractTop
public static java.util.List<ExtractedResult> extractTop(java.lang.String query, java.util.Collection<java.lang.String> choices, int limit)
Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choices- Parameters:
query- The query stringchoices- A list of choiceslimit- The number of results to return- Returns:
- A list of the results
-
extractSorted
public static java.util.List<ExtractedResult> extractSorted(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func)
Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicesfunc- The scoring function- Returns:
- A list of the results
-
extractSorted
public static java.util.List<ExtractedResult> extractSorted(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func, int cutoff)
Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicesfunc- The scoring functioncutoff- Keep only scores above cutoff- Returns:
- A list of the results
-
extractSorted
public static java.util.List<ExtractedResult> extractSorted(java.lang.String query, java.util.Collection<java.lang.String> choices)
Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choices- Returns:
- A list of the results
-
extractSorted
public static java.util.List<ExtractedResult> extractSorted(java.lang.String query, java.util.Collection<java.lang.String> choices, int cutoff)
Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicescutoff- Keep only scores above cutoff- Returns:
- A list of the results
-
extractAll
public static java.util.List<ExtractedResult> extractAll(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func)
Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicesfunc- The scoring function- Returns:
- A list of the results
-
extractAll
public static java.util.List<ExtractedResult> extractAll(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func, int cutoff)
Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicesfunc- The scoring functioncutoff- Keep only scores above cutoff- Returns:
- A list of the results
-
extractAll
public static java.util.List<ExtractedResult> extractAll(java.lang.String query, java.util.Collection<java.lang.String> choices)
Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choices- Returns:
- A list of the results
-
extractAll
public static java.util.List<ExtractedResult> extractAll(java.lang.String query, java.util.Collection<java.lang.String> choices, int cutoff)
Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicescutoff- Keep only scores above cutoff- Returns:
- A list of the results
-
extractOne
public static ExtractedResult extractOne(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func)
Find the single best match above a score in a list of choices.- Parameters:
query- A string to match againstchoices- A list of choicesfunc- Scoring function- Returns:
- An object containing the best match and it's score
-
extractOne
public static ExtractedResult extractOne(java.lang.String query, java.util.Collection<java.lang.String> choices)
Find the single best match above a score in a list of choices.- Parameters:
query- A string to match againstchoices- A list of choices- Returns:
- An object containing the best match and it's score
-
extractTop
public static <T> java.util.List<BoundExtractedResult<T>> extractTop(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func, int limit, int cutoff)
Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choices- Parameters:
query- The query stringchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.func- The scoring function- Returns:
- A list of the results
-
extractTop
public static <T> java.util.List<BoundExtractedResult<T>> extractTop(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, int limit, int cutoff)
Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choices- Parameters:
query- 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 this- Returns:
- A list of the results
-
extractTop
public static <T> java.util.List<BoundExtractedResult<T>> extractTop(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func, int limit)
Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choices- Parameters:
query- The query stringchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.func- The scoring functionlimit- The number of results to return- Returns:
- A list of the results
-
extractTop
public static <T> java.util.List<BoundExtractedResult<T>> extractTop(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, int limit)
Creates a sorted list ofExtractedResultwhich contain the top @param limit most similar choices- Parameters:
query- The query stringchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.limit- The number of results to return- Returns:
- A list of the results
-
extractSorted
public static <T> java.util.List<BoundExtractedResult<T>> extractSorted(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func)
Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.func- The scoring function- Returns:
- A list of the results
-
extractSorted
public static <T> java.util.List<BoundExtractedResult<T>> extractSorted(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func, int cutoff)
Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.func- The scoring functioncutoff- Keep only scores above cutoff- Returns:
- A list of the results
-
extractSorted
public static <T> java.util.List<BoundExtractedResult<T>> extractSorted(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction)
Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.- Returns:
- A list of the results
-
extractSorted
public static <T> java.util.List<BoundExtractedResult<T>> extractSorted(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, int cutoff)
Creates a sorted list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.cutoff- Keep only scores above cutoff- Returns:
- A list of the results
-
extractAll
public static <T> java.util.List<BoundExtractedResult<T>> extractAll(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func)
Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.func- The scoring function- Returns:
- A list of the results
-
extractAll
public static <T> java.util.List<BoundExtractedResult<T>> extractAll(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func, int cutoff)
Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.func- The scoring functioncutoff- Keep only scores above cutoff- Returns:
- A list of the results
-
extractAll
public static <T> java.util.List<BoundExtractedResult<T>> extractAll(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction)
Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.- Returns:
- A list of the results
-
extractAll
public static <T> java.util.List<BoundExtractedResult<T>> extractAll(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, int cutoff)
Creates a list ofExtractedResultwhich contain all the choices with their corresponding score where higher is more similar- Parameters:
query- The query stringchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.cutoff- Keep only scores above cutoff- Returns:
- A list of the results
-
extractOne
public static <T> BoundExtractedResult<T> extractOne(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction, Applicable func)
Find the single best match above a score in a list of choices.- Parameters:
query- A string to match againstchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.func- Scoring function- Returns:
- An object containing the best match and it's score
-
extractOne
public static <T> BoundExtractedResult<T> extractOne(java.lang.String query, java.util.Collection<T> choices, ToStringFunction<T> toStringFunction)
Find the single best match above a score in a list of choices.- Parameters:
query- A string to match againstchoices- A list of choicestoStringFunction- The ToStringFunction to be applied to all choices.- Returns:
- An object containing the best match and it's score
-
-