Supervised segmentation with application to speech recognition