calculate topic distribution