partial step towards implementing semi-Markov CRF