Safe Haskell | None |
---|
Alternative cost representation with individual cost components divided into groups with respect to operation weights.
- data Group a = Filter {}
- data CostDiv a = CostDiv {}
- costDefault :: Eq a => CostDiv a
- type Sub a = Map Weight (Set a)
- mkSub :: Ord a => [(a, Weight)] -> Sub a
- unSub :: Ord a => Sub a -> [Group a]
- type SubMap a = Map a (Sub a)
- subOn :: Ord a => a -> SubMap a -> Sub a
- mkSubMap :: Ord a => [(a, a, Weight)] -> SubMap a
- toCost :: Double -> CostDiv a -> Cost a
- toCostInf :: CostDiv a -> Cost a
CostDiv
A Group describes a weight of some edit operation in which a character satistying the predicate is involved. This data structure is meant to collect all characters which determine the same operation weight.
Cost function with edit operations divided with respect to weight. Two operations of the same type and with the same weight should be assigned to the same group.
CostDiv | |
|
costDefault :: Eq a => CostDiv aSource
Default cost with all edit operations having the unit weight.
Helper functions for CostDiv construction
mkSub :: Ord a => [(a, Weight)] -> Sub aSource
Construct the substitution descrition from the list of (character y
,
substition weight from x
to y
) pairs for some unspecified character
x
. Characters will be grouped with respect to weight.
unSub :: Ord a => Sub a -> [Group a]Source
Extract the list of groups (each group with unique weight) from the substitution description.
subOn :: Ord a => a -> SubMap a -> Sub aSource
Substitution description for the given character in the substitution map. In other words, the function returns information how the input character can be replaced with other characters from the alphabet.
mkSubMap :: Ord a => [(a, a, Weight)] -> SubMap aSource
Construct the substitution map from the list of (x
, y
, weight of
x -> y
substitution) tuples.