implementation for hierarchical Dirichlet process via CRF