Canonical Sequence Extraction and HMM Model Building Based on Hierarchical Clustering 1