Class Extractor


  • public class Extractor
    extends java.lang.Object
    • Constructor Detail

      • Extractor

        public Extractor()
      • Extractor

        public Extractor​(int cutoff)
    • Method Detail

      • with

        public Extractor with​(int cutoff)
      • extractWithoutOrder

        public java.util.List<ExtractedResult> extractWithoutOrder​(java.lang.String query,
                                                                   java.util.Collection<java.lang.String> choices,
                                                                   Applicable func)
        Returns the list of choices with their associated scores of similarity in a list of ExtractedResult
        Parameters:
        query - The query string
        choices - The list of choices
        func - The function to apply
        Returns:
        The list of results
      • extractWithoutOrder

        public <T> java.util.List<BoundExtractedResult<T>> extractWithoutOrder​(java.lang.String query,
                                                                               java.util.Collection<T> choices,
                                                                               ToStringFunction<T> toStringFunction,
                                                                               Applicable func)
        Returns the list of choices with their associated scores of similarity in a list of ExtractedResult
        Parameters:
        query - The query string
        choices - The list of choices
        toStringFunction - The ToStringFunction to be applied to all choices.
        func - The function to apply
        Returns:
        The list of results
      • extractOne

        public 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 <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
      • extractTop

        public java.util.List<ExtractedResult> extractTop​(java.lang.String query,
                                                          java.util.Collection<java.lang.String> choices,
                                                          Applicable func)
        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 <T> java.util.List<BoundExtractedResult<T>> extractTop​(java.lang.String query,
                                                                      java.util.Collection<T> choices,
                                                                      ToStringFunction<T> toStringFunction,
                                                                      Applicable func)
        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 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
        limit - Limits the number of results and speeds up the search (k-top heap sort) is used
        Returns:
        A list of the results
      • extractTop

        public <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.
        limit - Limits the number of results and speeds up the search (k-top heap sort) is used
        Returns:
        A list of the results
      • getCutoff

        public int getCutoff()
      • setCutoff

        public void setCutoff​(int cutoff)