Discriminative Learning for Probabilistic Sequence Analysis