Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Parallel versions of filter
and simpleFilter
Synopsis
- filter :: Int -> Int -> Text -> [t] -> (t -> Text) -> [Scored t]
- filter' :: Int -> Int -> Text -> [t] -> (t -> Text) -> (Text -> Text -> Maybe Int) -> [Scored t]
- simpleFilter :: Int -> Int -> Text -> [Text] -> [Scored Text]
- simpleFilter' :: Int -> Int -> Text -> [Text] -> (Text -> Text -> Maybe Int) -> [Scored Text]
- match :: Text -> Text -> Maybe Int
- defChunkSize :: Int
- defMaxResults :: Int
- data Scored a = Scored {}
Documentation
:: Int | Chunk size. 1000 works well. |
-> Int | Max. number of results wanted |
-> Text | Pattern. |
-> [t] | The list of values containing the text to search in. |
-> (t -> Text) | The function to extract the text from the container. |
-> [Scored t] | The list of results, sorted, highest score first. |
The function to filter a list of values by fuzzy search on the text extracted from them, using a custom matching function which determines how close words are.
:: Int | Chunk size. 1000 works well. |
-> Int | Max. number of results wanted |
-> Text | Pattern. |
-> [t] | The list of values containing the text to search in. |
-> (t -> Text) | The function to extract the text from the container. |
-> (Text -> Text -> Maybe Int) | Custom scoring function to use for calculating how close words are When the function returns Nothing, this means the values are incomparable. |
-> [Scored t] | The list of results, sorted, highest score first. |
The function to filter a list of values by fuzzy search on the text extracted from them, using a custom matching function which determines how close words are.
:: Int | Chunk size. 1000 works well. |
-> Int | Max. number of results wanted |
-> Text | Pattern to look for. |
-> [Text] | List of texts to check. |
-> [Scored Text] | The ones that match. |
Return all elements of the list that have a fuzzy match against the pattern. Runs with default settings where nothing is added around the matches, as case insensitive.
>>>
simpleFilter 1000 10 "vm" ["vim", "emacs", "virtual machine"]
[Scored {score = 4, original = "vim"},Scored {score = 4, original = "virtual machine"}]
:: Int | Chunk size. 1000 works well. |
-> Int | Max. number of results wanted |
-> Text | Pattern to look for. |
-> [Text] | List of texts to check. |
-> (Text -> Text -> Maybe Int) | Custom scoring function to use for calculating how close words are |
-> [Scored Text] | The ones that match. |
Return all elements of the list that have a fuzzy match against the pattern, the closeness of the match is determined using the custom scoring match function that is passed. Runs with default settings where nothing is added around the matches, as case insensitive.
:: Text | Pattern in lowercase except for first character |
-> Text | The text to search in. |
-> Maybe Int | The score |
Returns the rendered output and the matching score for a pattern and a text. Two examples are given below:
>>>
match "fnt" "infinite"
Just 3
>>>
match "hsk" "Haskell"
Just 5
defChunkSize :: Int Source #
Sensible default value for chunk size to use when calling simple filter.
defMaxResults :: Int Source #
Sensible default value for the number of max results to use when calling simple filter.