Java code I used to train hidden Markov models on top of page-level classification. Weka is a dependency.