摘 要: 中国古诗因其严谨的平仄、押韵结构,精练传神的用词成为文本自动生成领域的挑战问题之一。本文基于双向多层转换编解码的空间向量,结合Attention机制建立了循环神经网络结构的诗自动生成模型。为解决自动生成诗的主题发散性问题,模型在生成每句诗时均增加了关键词约束。此外,为了增强诗句之间的对仗性和语义的连贯性,模型双向多层转换编解码的词嵌入式输入添加了诗句的对齐向量。实验结果表明,相比于以词转换为向量的词嵌入式的诗自动生成模型,本文设计的基于BERT的对齐向量输入模型生成的诗不仅在机器评估和人工评估中性能较优,而且生成诗句相邻句子的相关性也最好。这也进一步说明,当模型的输入向量能充分表达诗词的格式、内容和语义时,双向多层转换编解码的向量表示,即Attention机制+循环神经网络构建的诗生成模型可以生成较接近人工作的诗。 |
关键词: Attention机制;双向多层转换编解码;诗;自动生成;循环神经网络 |
中图分类号: TP391
文献标识码: A
|
基金项目: 国家自然科学基金资助项目“集成在诗词自动创作中的信息隐写方法”(61862002). |
|
Automatic Generation of Poem based on Two-way Multi-layer Conversion Codec |
YANG Taikang, YANG Wanxia, LIU Yan, HU Zhiyu, WANG Qiaozhen, XU Mingjie
|
(School of Mechanical and Electrical Engineering, Gansu Agricultural University, Lanzhou 730070, China )
2605946368@qq.com; yangwanxia@163.com; 751741004@qq.com; hzybest@foxmail.com; 3146477442@qq.com; 1004106102@qq.com
|
Abstract: Chinese ancient poems have become one of the challenges in the field of automatic text generation because of their tonal patterns, rhyming structure, and vivid words. This paper proposes to establish an automatic poem generation model with a recurrent neural network structure. This model is combined with Attention and is based on space vector of two-way multi-layer conversion codec. In order to solve the problem of divergence of automatically generated poems, the model adds keyword constraints when generating each poem. In addition, in order to enhance antithesis between verses and semantic coherence, word embedded input of the model's two-way multi-layer conversion encoding and decoding adds alignment vector of the poem. The experimental results show that compared with word-embedded poem automatic generation model in which words are converted into vectors, poems generated by BERT-based aligned vector input model proposed in this paper, not only perform better in machine and manual evaluation, but also generate poetic sentences. The correlation between adjacent sentences and the generated verse is also the best. This also further shows that when input vector of the model can fully express the format, content and semantics of the poem, vector representation of the two-way multi-layer conversion codec, the Attention Mechanism + cyclic neural network construction of poem generation model can generate poems closer to human's works. |
Keywords: Attention Mechanism; two-way multi-layer conversion codec; poem; automatic generation; Recurrent Neural Network |