From d4fb4b0fdcf6c11fa75732d3ea3470a934d281ad Mon Sep 17 00:00:00 2001 From: mrkkrp Date: Thu, 27 Apr 2017 23:43:48 +0300 Subject: [PATCH] Some minor corrections to the docs --- Data/Text/Metrics.hs | 20 +++++++++++--------- README.md | 10 +++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Data/Text/Metrics.hs b/Data/Text/Metrics.hs index ddad99f..c805215 100644 --- a/Data/Text/Metrics.hs +++ b/Data/Text/Metrics.hs @@ -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 @@ -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: . @@ -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. -- @@ -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 diff --git a/README.md b/README.md index 34445ce..d67e4c6 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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