Class FuzzySearch


  • public class FuzzySearch
    extends java.lang.Object
    FuzzySearch 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
      static java.util.List<ExtractedResult> extractAll​(java.lang.String query, java.util.Collection<java.lang.String> choices, int cutoff)
      Creates a list of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
      static java.util.List<ExtractedResult> extractAll​(java.lang.String query, java.util.Collection<java.lang.String> choices, Applicable func)
      Creates a list of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
      static java.util.List<ExtractedResult> extractAll​(java.lang.String query, java.util.Collection<java.lang.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> java.util.List<BoundExtractedResult<T>> extractAll​(java.lang.String query, java.util.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> java.util.List<BoundExtractedResult<T>> extractAll​(java.lang.String query, java.util.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> java.util.List<BoundExtractedResult<T>> extractAll​(java.lang.String query, java.util.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> 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
      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.
      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.
      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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
      static java.util.List<ExtractedResult> extractSorted​(java.lang.String query, java.util.Collection<java.lang.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 java.util.List<ExtractedResult> extractSorted​(java.lang.String query, java.util.Collection<java.lang.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 java.util.List<ExtractedResult> extractSorted​(java.lang.String query, java.util.Collection<java.lang.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> java.util.List<BoundExtractedResult<T>> extractSorted​(java.lang.String query, java.util.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> java.util.List<BoundExtractedResult<T>> extractSorted​(java.lang.String query, java.util.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> java.util.List<BoundExtractedResult<T>> extractSorted​(java.lang.String query, java.util.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> 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
      static java.util.List<ExtractedResult> extractTop​(java.lang.String query, java.util.Collection<java.lang.String> choices, int limit)
      Creates a sorted list of ExtractedResult which contain the top @param limit most similar choices
      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 of ExtractedResult which contain the top @param limit most similar choices
      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 of ExtractedResult which contain the top @param limit most similar choices
      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 of ExtractedResult which contain the top @param limit most similar choices
      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 of ExtractedResult which contain the top @param limit most similar choices
      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 of ExtractedResult which contain the top @param limit most similar choices
      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 of ExtractedResult which contain the top @param limit most similar choices
      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 of ExtractedResult which contain the top @param limit most similar choices
      static int partialRatio​(java.lang.String s1, java.lang.String s2)
      Inconsistent substrings lead to problems in matching.
      static int partialRatio​(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)
      Inconsistent substrings lead to problems in matching.
      static int ratio​(java.lang.String s1, java.lang.String s2)
      Calculates a Levenshtein simple ratio between the strings.
      static int ratio​(java.lang.String s1, java.lang.String s2, ToStringFunction<java.lang.String> stringFunction)
      Calculates a Levenshtein simple ratio between the strings.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      static int weightedRatio​(java.lang.String s1, java.lang.String s2)
      Calculates a weighted ratio between the different algorithms for best results
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FuzzySearch

        public FuzzySearch()
    • 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 string
        s2 - 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 string
        s2 - Input string
        stringFunction - 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 string
        s2 - 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 string
        s2 - Input string
        stringFunction - 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 string
        s2 - 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 string
        s2 - Input string
        stringFunction - 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 string
        s2 - 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 string
        s2 - Input string
        stringFunction - 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 string
        s2 - 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 string
        s2 - Input string
        stringFunction - 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 string
        s2 - 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 string
        s2 - Input string
        stringFunction - 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 string
        s2 - 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 string
        s2 - Input string
        stringFunction - 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 of ExtractedResult which contain the top @param limit most similar choices
        Parameters:
        query - The query string
        choices - A list of choices
        func - 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 of ExtractedResult which contain the top @param limit most similar choices
        Parameters:
        query - The query string
        choices - A list of choices
        limit - Limits the number of results and speeds up the search (k-top heap sort) is used
        cutoff - 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 of ExtractedResult which contain the top @param limit most similar choices
        Parameters:
        query - The query string
        choices - A list of choices
        func - The scoring function
        limit - 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 of ExtractedResult which contain the top @param limit most similar choices
        Parameters:
        query - The query string
        choices - A list of choices
        limit - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        func - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        func - The scoring function
        cutoff - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        cutoff - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        func - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        func - The scoring function
        cutoff - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        cutoff - 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 against
        choices - A list of choices
        func - 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 against
        choices - 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 of ExtractedResult which contain the top @param limit most similar choices
        Parameters:
        query - The query string
        choices - A list of choices
        toStringFunction - 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 of ExtractedResult which contain the top @param limit most similar choices
        Parameters:
        query - The query string
        choices - A list of choices
        toStringFunction - The ToStringFunction to be applied to all choices.
        limit - Limits the number of results and speeds up the search (k-top heap sort) is used
        cutoff - 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 of ExtractedResult which contain the top @param limit most similar choices
        Parameters:
        query - The query string
        choices - A list of choices
        toStringFunction - The ToStringFunction to be applied to all choices.
        func - The scoring function
        limit - 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 of ExtractedResult which contain the top @param limit most similar choices
        Parameters:
        query - The query string
        choices - A list of choices
        toStringFunction - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        toStringFunction - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        toStringFunction - The ToStringFunction to be applied to all choices.
        func - The scoring function
        cutoff - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        toStringFunction - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        toStringFunction - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        toStringFunction - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        toStringFunction - The ToStringFunction to be applied to all choices.
        func - The scoring function
        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)
        Creates a list of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        toStringFunction - 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 of ExtractedResult which contain all the choices with their corresponding score where higher is more similar
        Parameters:
        query - The query string
        choices - A list of choices
        toStringFunction - 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 against
        choices - A list of choices
        toStringFunction - 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 against
        choices - A list of choices
        toStringFunction - The ToStringFunction to be applied to all choices.
        Returns:
        An object containing the best match and it's score