Gibbs sampling for hierarchical Dirichlet process