copied fourgram LM and topic model from Callie's fork