Library

FST · Rational transduction

Squeeze repeated letters: tr -s

Collapse every run of the same letter to one: aaabbba becomes aba, as the Unix command tr -s does. The machine remembers the last letter it printed and prints nothing while the same letter repeats — an edge with an empty output.

startlastAlastBa/ab/ba/b/bb/a/a
The machine as drawn — 3 states, 6 transitions.

The author’s examples, run

a → reject · ab → reject · baa → reject · aab → reject · abaaa → reject · abbbbbabbaaabbaaa → reject · bababa