Our generator implementation is largely based on that of <cite>Lau et al. (2018)</cite> . The main difference is that we first generate all the line-ending words and then condition on them to generate the remaining words.