unit_writer: fix the phoneme type checking logic