Need help with StylisticPoetry?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

172 Stars 57 Forks 12 Commits 5 Opened issues


Codes for Stylistic Chinese Poetry Generation via Unsupervised Style Disentanglement (EMNLP 2018)

Services available


Need anything else?

Contributors list

Stylistic Poetry

Developed by 清华大学人工智能研究院与社会人文计算研究中心. The codes basically come from our paper "Stylistic Chinese Poetry Generation via Unsupervised Style Disentanglement" (EMNLP 2018).

Input files

vocab.pkl: The dictionary of character -> character id.

ivocab.pkl: The dictionary of character id -> character.

texttrain.pkl, textdev.pkl and texttest.pkl: Corpus files for training, validation and testing. Please refer to data/ for details about how to transform the poems into the required format.

Main scripts The implementation of the SPG model. The basis of this model is an LSTM encoder-decoder framework with attention mechanism. The hyper-parameter settings. The interface for training. Just setup the hyperparameters and use the command "python". The interface for testing. Given the first sentence as input, a whole poem with four lines will be generated.


tensorflow-gpu 1.12


If you find this code useful for your research, please kindly cite this paper:

  title={Stylistic Chinese Poetry Generation via Unsupervised Style Disentanglement},
  author={Yang, Cheng and Sun, Maosong and Yi, Xiaoyuan and Li, Wenhao},
  booktitle={Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing},

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.