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`. Copy
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. Copy
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.
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.
The following could be used to make inserting, removing, or replacing vowels cheaper.
Note: the default edit distance is 100.