::consonant:: = b|d|ch|f|g|h|j|k|l|m|n|p|r|s|t|th|v|w|z
::vowel:: = a|e|i|o|u

% Realization of coda <g>/<gh>. Not word-initial, not after <n> (<ng> is /ŋ/),
% and not before <r>, <l> or <w> (onset clusters such as <gr>, <gl>).
g -> ch / (?<=\w)(?<!n) _ (?=#|(?![rlw])(::consonant::))
gh -> ch / _ #|(::consonant::)

% Final stop devoicing. Not word-initial and not before <r>, <l> or <w>
% (onset clusters such as <br>, <bl>, <dr>, <dw>).
b -> p / (?<=\w) _ (?=#|(?![rlw])(::consonant::))
d -> t / (?<=\w) _ (?=#|(?![rlw])(::consonant::))

% Contextual pronunciation of <sch>: /s/ word-finally or before a consonant
% other than <r> (<schr> is /sxr/).
sch -> s / _ #|(?!r)(::consonant::)

% Realization of <c>
c -> k / _ #
c -> s / _ [eiy]

% Open syllable lengthening. A vowel letter that is the second element of a
% digraph (<aa>, <ie>, <ee>, <oe>, <ai>, <ei>, <oi>, <ui>, <oo>, <eu>, <au>,
% <ou>, <uu>) is not lengthened again, and <i> in <ij> is not lengthened.
a -> aa / (?<!a) _ #|(::consonant::)(::vowel::)
e -> ee / (?<![eio]) _ #|(::consonant::)(::vowel::)
i -> ii / (?<![aeou]) _ (?!j)(#|(::consonant::)(::vowel::))
o -> oo / (?<!o) _ #|(::consonant::)(::vowel::)
u -> uu / (?<![aeou]) _ #|(::consonant::)(::vowel::)
