edits-0.1.1.0: show the differences between 2 pieces of Text using the Levenshtein distance
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Text.EditMatrix

Description

This module computes a matrix keeping track of the costs necessary to edit one piece of text so that it is transformed into another one From that matrix it is possible to extract the sequence of edit operations with the minimum cost

Synopsis

Documentation

createEditMatrix :: Costs a -> [a] -> [a] -> Matrix Cost Source #

Create a edit matrix where costs are computed using dynamic programming

makeEditOperations :: forall a. Vector a -> Vector a -> Matrix Cost -> Vector (EditOperation a) Source #

From the original lists of characters, given the cost matrix return a list of edit operations allowing to edit one text and eventually get the second one

getElement :: Int -> Int -> Matrix a -> a Source #

Return the element at position i, j in the matrix A matrix in the matrix package is 1-indexed but all the computations in this module are 0-indexed so we need to shift the indices

setElement :: a -> Int -> Int -> Matrix a -> Matrix a Source #

Set the element at position i, j in the matrix A matrix in the matrix package is 1-indexed but all the computations in this module are 0-indexed so we need to shift the indices