Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- add :: MonadFuzzySearch m => Text -> m Bool
- add_ :: MonadFuzzySearch m => Text -> m ()
- findMin :: MonadFuzzySearch m => Double -> Text -> m [FuzzyMatch]
- values :: MonadFuzzySearch m => m [Text]
- addMany :: MonadFuzzySearch m => [Text] -> m [Text]
- addMany_ :: MonadFuzzySearch m => [Text] -> m ()
- find :: MonadFuzzySearch m => Text -> m [FuzzyMatch]
- findOne :: MonadFuzzySearch m => Text -> m (Maybe FuzzyMatch)
- findOneMin :: MonadFuzzySearch m => Double -> Text -> m (Maybe FuzzyMatch)
- closestMatch :: MonadFuzzySearch m => Text -> m (Maybe Text)
- closestMatchMin :: MonadFuzzySearch m => Double -> Text -> m (Maybe Text)
- size :: MonadFuzzySearch m => m Int
- isEmpty :: MonadFuzzySearch m => m Bool
- newtype FuzzySearchT m a = FuzzySearchT {
- getFuzzySearchT :: StateT FuzzySet m a
- type FuzzySearch = FuzzySearchT Identity
- runFuzzySearchT :: Monad m => FuzzySearchT m a -> Int -> Int -> Bool -> m a
- runDefaultFuzzySearchT :: Monad m => FuzzySearchT m a -> m a
- runFuzzySearch :: FuzzySearch a -> Int -> Int -> Bool -> a
- runDefaultFuzzySearch :: FuzzySearch a -> a
- class MonadState FuzzySet m => MonadFuzzySearch m
Documentation
:: MonadFuzzySearch m | |
=> Text | The new entry |
-> m Bool | A flag to indicate whether the value was added (i.e., did not already exist in the set) | Try to match a string against the entries in the set, and return a list of all results with a score greater than or equal to the specified minimum score (i.e., the first argument). The results are ordered by similarity, with the closest match first. |
Add a string to the set. A boolean is returned which is True
if the
string was inserted, or False
if it already existed in the set.
add_ :: MonadFuzzySearch m => Text -> m () Source #
Add a string to the set, or do nothing if a key that matches the string already exists.
This function is identical to add
, except that the latter returns a
boolean to indicate whether any new value was added.
:: MonadFuzzySearch m | |
=> Double | A minimum score |
-> Text | The string to search for |
-> m [FuzzyMatch] | A list of results (score and matched value) |
values :: MonadFuzzySearch m => m [Text] Source #
Return the elements of the set. No particular order is guaranteed.
:: MonadFuzzySearch m | |
=> [Text] | A list of strings to add to the set |
-> m [Text] | A list of values that were inserted |
Add a list of strings to the set, all at once.
Unless you need to know the subset of values that were actually inserted,
use addMany_
instead.
:: MonadFuzzySearch m | |
=> [Text] | A list of strings to add to the set |
-> m () |
Add a list of strings to the set, all at once.
This function is identical to addMany
, except that the latter returns a
list of all values that were inserted.
:: MonadFuzzySearch m | |
=> Text | The string to search for |
-> m [FuzzyMatch] | A list of results (score and matched value) |
Try to match the given string against the entries in the set, using a
minimum score of 0.33. Return a list of results ordered by similarity
score, with the closest match first. Use findMin
if you need to specify
a custom threshold value.
:: MonadFuzzySearch m | |
=> Text | The string to search for |
-> m (Maybe FuzzyMatch) | The closest match, if one is found |
Try to match the given string against the entries in the set, and return
the closest match, if one is found. A minimum score of 0.33 is used. To
specify a custom threshold value, instead use findOneMin
.
:: MonadFuzzySearch m | |
=> Double | A minimum score |
-> Text | The string to search for |
-> m (Maybe FuzzyMatch) | The closest match, if one is found |
Try to match the given string against the entries in the set using the specified minimum score and return the closest match, if one is found.
:: MonadFuzzySearch m | |
=> Text | The string to search for |
-> m (Maybe Text) | The string most closely matching the input, if a match is found |
Try to match the given string against the entries in the set, and return
the string that most closely matches the input, if a match is found. A
minimum score of 0.33 is used. To specify a custom threshold value,
instead use closestMatchMin
.
:: MonadFuzzySearch m | |
=> Double | A minimum score |
-> Text | The string to search for |
-> m (Maybe Text) | The string most closely matching the input, if a match is found |
Try to match the given string against the entries in the set using the specified minimum score and return the string that most closely matches the input, if a match is found.
size :: MonadFuzzySearch m => m Int Source #
Return the number of entries in the set.
isEmpty :: MonadFuzzySearch m => m Bool Source #
Return a boolean indicating whether the set is empty.
newtype FuzzySearchT m a Source #
FuzzySearch monad transformer
Instances
type FuzzySearch = FuzzySearchT Identity Source #
FuzzySearch monad
:: Monad m | |
=> FuzzySearchT m a | |
-> Int | Lower bound on gram sizes to use (inclusive) |
-> Int | Upper bound on gram sizes to use (inclusive) |
-> Bool | Whether or not to use the Levenshtein distance to determine the score |
-> m a | The result of running the computation in the inner monad |
Evaluate a FuzzySearchT
computation with the given options.
runDefaultFuzzySearchT :: Monad m => FuzzySearchT m a -> m a Source #
Evaluate a FuzzySearchT
computation with the following defaults:
- Gram size lower:
2
- Gram size upper:
3
- Use Levenshtein distance:
True
:: FuzzySearch a | |
-> Int | Lower bound on gram sizes to use (inclusive) |
-> Int | Upper bound on gram sizes to use (inclusive) |
-> Bool | Whether or not to use the Levenshtein distance to determine the score |
-> a | The result of running the computation |
Evaluate a FuzzySearch
computation with the given options.
runDefaultFuzzySearch :: FuzzySearch a -> a Source #
Evaluate a FuzzySearch
computation with the following defaults:
- Gram size lower:
2
- Gram size upper:
3
- Use Levenshtein distance:
True
class MonadState FuzzySet m => MonadFuzzySearch m Source #
Instances
Monad m => MonadFuzzySearch (FuzzySearchT m) Source # | |
Defined in Data.FuzzySet.Monad add :: Text -> FuzzySearchT m Bool Source # findMin :: Double -> Text -> FuzzySearchT m [FuzzyMatch] Source # | |
MonadFuzzySearch m => MonadFuzzySearch (MaybeT m) Source # | |
MonadFuzzySearch m => MonadFuzzySearch (ExceptT e m) Source # | |
MonadFuzzySearch m => MonadFuzzySearch (ReaderT r m) Source # | |
(MonadFuzzySearch m, MonadState FuzzySet (SelectT s m)) => MonadFuzzySearch (SelectT s m) Source # | |
MonadFuzzySearch m => MonadFuzzySearch (StateT FuzzySet m) Source # | |
(MonadFuzzySearch m, Monoid w) => MonadFuzzySearch (WriterT w m) Source # | |
MonadFuzzySearch m => MonadFuzzySearch (ContT r m) Source # | |