Jisuanji kexue yu tansuo (Jun 2020)

Custom Generation of Poetry Based on Seq2Seq Model

  • WANG Lewei, YU Ying, ZHANG Yinglong

DOI
https://doi.org/10.3778/j.issn.1673-9418.1905016
Journal volume & issue
Vol. 14, no. 6
pp. 1028 – 1035

Abstract

Read online

At present, the generation of ancient poems is mostly based on a single recurrent neural network (RNN) structure. When generating, a starting word needs to be given in advance, and then the starting word is used as the starting point to generate ancient poems. The generation process is poorly controllable and the expected results often fail. Aiming at the above problems, the attention mechanism is introduced into the Seq2Seq model, and training is performed through a self-built data set to implement keyword-based custom ancient poem generation. In the genera-tion phase, a descriptive content is input and the keywords are extracted from it. When the keywords are insu-fficient, word2vec is used to complete keywords effectively. In addition, in view of the difficulty in controlling the ancient poetry genre, a format control character is added to the Encoder of the Seq2Seq model, which effectively solves the randomness of genre selection caused by previous model when generating ancient poems. Experiments show that the proposed model achieves the expected generation effect well.

Keywords