unit_reader: make `read()` state based

This reworks unit_reader::read() to use a state machine when
processing the phonemes.