-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Calculate various string metrics efficiently
--   
--   Calculate various string metrics efficiently.
@package text-metrics
@version 0.3.2


-- | The module provides efficient implementations of various strings
--   metric algorithms. It works with strict <a>Text</a> values.
--   
--   <b>Note</b>: before version <i>0.3.0</i> the package used C
--   implementations of the algorithms under the hood. Beginning from
--   version <i>0.3.0</i>, the implementations are written in Haskell while
--   staying almost as fast, see:
--   
--   <a>https://markkarpov.com/post/migrating-text-metrics.html</a>
module Data.Text.Metrics

-- | Return the Levenshtein distance between two <a>Text</a> values. The
--   Levenshtein distance between two strings is the minimal number of
--   operations necessary to transform one string into another. For the
--   Levenshtein distance allowed operations are: deletion, insertion, and
--   substitution.
--   
--   See also: <a>https://en.wikipedia.org/wiki/Levenshtein_distance</a>.
--   
--   <b>Heads up</b>, before version <i>0.3.0</i> this function returned
--   <a>Natural</a>.
levenshtein :: Text -> Text -> Int

-- | Return the normalized Levenshtein distance between two <a>Text</a>
--   values. Result is a non-negative rational number (represented as
--   <tt><a>Ratio</a> <a>Natural</a></tt>), where 0 signifies no similarity
--   between the strings, while 1 means exact match.
--   
--   See also: <a>https://en.wikipedia.org/wiki/Levenshtein_distance</a>.
--   
--   <b>Heads up</b>, before version <i>0.3.0</i> this function returned
--   <tt><a>Ratio</a> <a>Natural</a></tt>.
levenshteinNorm :: Text -> Text -> Ratio Int

-- | Return the Damerau-Levenshtein distance between two <a>Text</a>
--   values. The function works like <a>levenshtein</a>, but the collection
--   of allowed operations also includes transposition of two
--   <i>adjacent</i> characters.
--   
--   See also:
--   <a>https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance</a>.
--   
--   <b>Heads up</b>, before version <i>0.3.0</i> this function returned
--   <a>Natural</a>.
damerauLevenshtein :: Text -> Text -> Int

-- | Return the normalized Damerau-Levenshtein distance between two
--   <a>Text</a> values. 0 signifies no similarity between the strings,
--   while 1 means exact match.
--   
--   See also:
--   <a>https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance</a>.
--   
--   <b>Heads up</b>, before version <i>0.3.0</i> this function returned
--   <tt><a>Ratio</a> <a>Natural</a></tt>.
damerauLevenshteinNorm :: Text -> Text -> Ratio Int

-- | Return the overlap coefficient for two <a>Text</a> values. Returned
--   value is in the range from 0 (no similarity) to 1 (exact match).
--   Return 1 if both <a>Text</a> values are empty.
--   
--   See also: <a>https://en.wikipedia.org/wiki/Overlap_coefficient</a>.
overlap :: Text -> Text -> Ratio Int

-- | Return the Jaccard similarity coefficient for two <a>Text</a> values.
--   Returned value is in the range from 0 (no similarity) to 1 (exact
--   match). Return 1 if both
--   
--   See also: <a>https://en.wikipedia.org/wiki/Jaccard_index</a>
jaccard :: Text -> Text -> Ratio Int

-- | <i>O(n)</i> Return the Hamming distance between two <a>Text</a>
--   values. Hamming distance is defined as the number of positions at
--   which the corresponding symbols are different. The input <a>Text</a>
--   values should be of equal length or <a>Nothing</a> will be returned.
--   
--   See also: <a>https://en.wikipedia.org/wiki/Hamming_distance</a>.
--   
--   <b>Heads up</b>, before version <i>0.3.0</i> this function returned
--   <tt><a>Maybe</a> <a>Natural</a></tt>.
hamming :: Text -> Text -> Maybe Int

-- | Return the Jaro distance between two <a>Text</a> values. Returned
--   value is in the range from 0 (no similarity) to 1 (exact match).
--   
--   While the algorithm is pretty clear for artificial examples (like
--   those from the linked Wikipedia article), for <i>arbitrary</i>
--   strings, it may be hard to decide which of two strings should be
--   considered as one having “reference” order of characters (order of
--   matching characters in an essential part of the definition of the
--   algorithm). This makes us consider the first string the “reference”
--   string (with correct order of characters). Thus generally,
--   
--   <pre>
--   jaro a b ≠ jaro b a
--   </pre>
--   
--   This asymmetry can be found in all implementations of the algorithm on
--   the internet, AFAIK.
--   
--   See also:
--   <a>https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance</a>
--   
--   <b>Heads up</b>, before version <i>0.3.0</i> this function returned
--   <tt><a>Ratio</a> <a>Natural</a></tt>.
jaro :: Text -> Text -> Ratio Int

-- | Return the Jaro-Winkler distance between two <a>Text</a> values.
--   Returned value is in range from 0 (no similarity) to 1 (exact match).
--   
--   See also:
--   <a>https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance</a>
--   
--   <b>Heads up</b>, before version <i>0.3.0</i> this function returned
--   <tt><a>Ratio</a> <a>Natural</a></tt>.
jaroWinkler :: Text -> Text -> Ratio Int
