Type alias SuggestionCostMapDef

SuggestionCostMapDef: CostMapDefReplace | CostMapDefInsDel | CostMapDefSwap

A WeightedMapDef enables setting weights for edits between related characters and substrings.

Multiple groups can be defined using a |. A multi-character substring is defined using ().

For example, in some languages, some letters sound alike.

  map: 'sc(sh)(sch)(ss)|t(tt)' # two groups.
replace: 50 # Make it 1/2 the cost of a normal edit to replace a `t` with `tt`.

The following could be used to make inserting, removing, or replacing vowels cheaper.

  map: 'aeiouy'
insDel: 50 # Make it is cheaper to insert or delete a vowel.
replace: 45 # It is even cheaper to replace one with another.

Note: the default edit distance is 100.