Skip to content
项目

关于

IJCAI 2018 论文《使用神经网络生成从主题到文章》的代码和数据

机器学习

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
正在收集历史
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

MTA-LSTM

We focus on essay generation, which is a challenging task that generates a paragraph-level text with multiple topics. Progress towards understanding different topics and expressing diversity in this task requires more powerful generators and richer training and evaluation resources. To address this, we develop a multi-topic-aware long short-term memory (MTA-LSTM) network. In this model, we maintain a novel multi-topic coverage vector, which learns the weight of of each topic and is sequentially updated during the decoding process. Afterwards this vector is fed to an attention model to guide the generator.

The code in this repository is written in Python 2.7/TensorFlow 1.4.0. And if you use other versions of Python or TensorFlow, you should modify some code.

Data Set

Composition Data Set: Download

Zhihu Data Set: Download

Usage

Data

In Data/ respository, you need to prepare two files TrainingData.txt and vec.txt(word embedding trained by word2vec), which is created from text dataset mentioned above.

Training

Before train the model, you should set some parameters of this model in Config.py file. Then, you need to run Preprocess.py file for creating coverage_data file(convert trainingdata into binary formats of TensorFlow, and more detail about this can be found in the blog), word_vec.pkl file(this is word embedding) and word_voc.pkl file(vocabulary of text). At the same time, you should set total_step parameter in Train.py whose value is got from output of Preprocess.py

Start training the model using Train.py:

$ python Train.py

Generation

After you train the model, you can generate the text in the control of word set. You should modify Generation.py file and set test_word to a set of words. Then, if you want, you can also set some parameters for generation in Config.py file. Generate text by run:

$ python Generation.py

探索相关项目

加载中…