% Move tones to end of word
(?P<sw1>[˩˨˧˦˥]+)(?P<sw2>\w+) -> 0 / _\b

% glottal stop - could already in end in 8th tone
h -> ʔ / _ #
h -> ʔ / _ ˥ #

% the following rules rely on the tone already being moved to the end of the word
% ends in h,p,t,k and does not have a tone diacritic - 4th tone
0 -> ˧ / [ʔptk] _ #

% if no tone diacritic and does not end in a stop - 1st tone
0 -> ˥ / ([^˩˨˧˦˥]) _ #
