structure for topic model code