Machine learning for text using latent information