Skip to content

Commit

Permalink
Some minor corrections to the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkkrp committed Apr 27, 2017
1 parent 75899dd commit d4fb4b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
20 changes: 11 additions & 9 deletions Data/Text/Metrics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
-- Stability : experimental
-- Portability : portable
--
-- The module provides efficient implementations of various strings metrics.
-- It works with strict 'Text' values and returns either 'Natural' numbers
-- (because the metrics cannot be negative), or @'Ratio' 'Natural'@ values
-- because returned values are rational non-negative numbers by definition.
-- The module provides efficient implementations of various strings metric
-- algorithms. It works with strict 'Text' values and returns either
-- 'Natural' numbers (because the metrics cannot be negative), or @'Ratio'
-- 'Natural'@ values because returned values are rational non-negative
-- numbers by definition.
--
-- The functions provided here are the fastest implementations available for
-- use in Haskell programs. In fact the functions are implemented in C for
Expand Down Expand Up @@ -59,9 +60,10 @@ import Control.Applicative
-- Levenshtein variants

-- | Return Levenshtein distance between two 'Text' values. Classic
-- Levenshtein distance between two strings is minimal number of operations
-- necessary to transform one string into another. For Levenshtein distance
-- allowed operations are: deletion, insertion, and substitution.
-- Levenshtein distance between two strings is the minimal number of
-- operations necessary to transform one string into another. For
-- Levenshtein distance allowed operations are: deletion, insertion, and
-- substitution.
--
-- See also: <https://en.wikipedia.org/wiki/Levenshtein_distance>.

Expand Down Expand Up @@ -111,7 +113,7 @@ damerauLevenshteinNorm = norm damerauLevenshtein
-- Other

-- | /O(n)/ Return Hamming distance between two 'Text' values. Hamming
-- distance is defined as number of positions at which the corresponding
-- distance is defined as the number of positions at which the corresponding
-- symbols are different. The input 'Text' values should be of equal length
-- or 'Nothing' will be returned.
--
Expand All @@ -129,7 +131,7 @@ foreign import ccall unsafe "tmetrics_hamming"
c_hamming :: CUInt -> Ptr Word16 -> Ptr Word16 -> IO CUInt

-- | Return Jaro distance between two 'Text' values. Returned value is in
-- range from 0 (no similarity) to 1 (exact match).
-- 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 /arbitrary/ strings, it may be
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
[![Build Status](https://travis-ci.org/mrkkrp/text-metrics.svg?branch=master)](https://travis-ci.org/mrkkrp/text-metrics)
[![Coverage Status](https://coveralls.io/repos/mrkkrp/text-metrics/badge.svg?branch=master&service=github)](https://coveralls.io/github/mrkkrp/text-metrics?branch=master)

The library provides efficient implementations of various strings metrics.
It works with strict `Text` values and returns either `Natural` numbers
(because the metrics cannot be negative), or `Ratio Natural` values because
returned values are rational non-negative numbers by definition.
The library provides efficient implementations of various strings metric
algorithms. It works with strict `Text` values and returns either `Natural`
numbers (because the metrics cannot be negative), or `Ratio Natural` values
because returned values are rational non-negative numbers by definition.

The functions provided here are the fastest implementations available for
use in Haskell programs. In fact the functions are implemented in C for
Expand Down Expand Up @@ -66,7 +66,7 @@ are:

## Implementation

All “meat” of the algorithms is written in C in a rather straightforward
All the “meat” of the algorithms is written in C in a rather straightforward
way. Levenshtein variants are based on the “iterative algorithm with two
matrix rows” from Wikipedia with additional improvement that we do not copy
current row of distances into previous row, but just swap the pointers
Expand Down

0 comments on commit d4fb4b0

Please sign in to comment.