Minimum error rate training for PHMM-based text recognition