Classification of categorical sequences