Giter VIP home page Giter VIP logo

stylisticpoetry's Introduction

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.

text_train.pkl, text_dev.pkl and text_test.pkl: Corpus files for training, validation and testing. Please refer to data/make_corpus.py for details about how to transform the poems into the required format.

Main scripts

model.py: The implementation of the SPG model. The basis of this model is an LSTM encoder-decoder framework with attention mechanism.

state.py: The hyper-parameter settings.

train.py: The interface for training. Just setup the hyperparameters and use the command "python train.py".

generate.py: The interface for testing. Given the first sentence as input, a whole poem with four lines will be generated.

Requirements

tensorflow-gpu 1.12

Cite

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

@inproceedings{yang2018stylistic,
  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},
  pages={3960--3969},
  year={2018}
}

stylisticpoetry's People

Contributors

xiaoyuanyi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.