packages feed

edit-distance-vector 1.0.0.2 → 1.0.0.3

raw patch · 3 files changed

+35/−10 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.Vector.Distance: cost :: Params v o c -> o -> c
- Data.Vector.Distance: delete :: Params v o c -> Int -> v -> o
- Data.Vector.Distance: equivalent :: Params v o c -> v -> v -> Bool
- Data.Vector.Distance: insert :: Params v o c -> Int -> v -> o
- Data.Vector.Distance: positionOffset :: Params v o c -> o -> Int
- Data.Vector.Distance: substitute :: Params v o c -> Int -> v -> v -> o
+ Data.Vector.Distance: [cost] :: Params v o c -> o -> c
+ Data.Vector.Distance: [delete] :: Params v o c -> Int -> v -> o
+ Data.Vector.Distance: [equivalent] :: Params v o c -> v -> v -> Bool
+ Data.Vector.Distance: [insert] :: Params v o c -> Int -> v -> o
+ Data.Vector.Distance: [positionOffset] :: Params v o c -> o -> Int
+ Data.Vector.Distance: [substitute] :: Params v o c -> Int -> v -> v -> o

Files

README.md view
@@ -32,7 +32,9 @@ `Vector`s.  ````{haskell}-import qualified Data.Vector as V+import           Data.Monoid++import qualified Data.Vector          as V import           Data.Vector.Distance  -- | Editing vectors of 'Char' values, with '(String, Int, Char)' describing@@ -40,12 +42,11 @@ str :: Params Char (String, Int, Char) (Sum Int) str = Params     { equivalent = (==)-    , delete i c = ("delete", i, c)-    , insert i c = ("insert", i, c)-    , substitute i c c' = ("replace", i, c')-    , cost _ = 1-    , positionOffset (op,_,_) | op == "delete" = 0-                              | otherwise      = 1+    , delete     = \i c    -> ("delete", i, c)+    , insert     = \i c    -> ("insert", i, c)+    , substitute = \i c c' -> ("replace", i, c')+    , cost = const (Sum 1)+    , positionOffset = \ (op, _, _) -> if op == "delete" then 0 else 1     }  main :: IO ()@@ -53,6 +54,9 @@     print $ leastChanges str (V.fromList "I am thomas")                              (V.fromList "My name is Thomas") ````++(See `test/sample.hs` for a version of this code that is compiled+by the automated test suite.)  [badge]: https://travis-ci.org/thsutton/edit-distance-vector.svg?branch=master [status]: https://travis-ci.org/thsutton/edit-distance-vector
edit-distance-vector.cabal view
@@ -1,5 +1,5 @@ name:                edit-distance-vector-version:             1.0.0.2+version:             1.0.0.3 synopsis:            Calculate edit distances and edit scripts between vectors. description:   An implementation of the Wagner–Fischer dynamic programming algorithm to@@ -23,7 +23,7 @@ copyright:           (c) 2015 Thomas Sutton and others. category:            Data, Data Structures, Algorithms build-type:          Simple-extra-source-files:  README.md, CHANGELOG.md+extra-source-files:  README.md, CHANGELOG.md, test/sample.hs cabal-version:       >=1.10  source-repository    HEAD@@ -44,7 +44,7 @@   type:                exitcode-stdio-1.0   hs-source-dirs:      test   main-is:             properties.hs-  build-depends:     +  build-depends:       base     , QuickCheck     , edit-distance-vector
+ test/sample.hs view
@@ -0,0 +1,21 @@+import           Data.Monoid++import qualified Data.Vector          as V+import           Data.Vector.Distance++-- | Editing vectors of 'Char' values, with '(String, Int, Char)' describing+--   changes, and the additive monoid of 'Int' describing costs.+str :: Params Char (String, Int, Char) (Sum Int)+str = Params+    { equivalent = (==)+    , delete     = \i c    -> ("delete", i, c)+    , insert     = \i c    -> ("insert", i, c)+    , substitute = \i c c' -> ("replace", i, c')+    , cost = const (Sum 1)+    , positionOffset = \ (op, _, _) -> if op == "delete" then 0 else 1+    }++main :: IO ()+main = do+    print $ leastChanges str (V.fromList "I am thomas")+                             (V.fromList "My name is Thomas")