Text this: Unsupervised learning of lattice models