Variational Learning Frameworks for Generative Models Based on Hierarchical Dirichlet and Pitman-Yor Processes