Research paper code for neural template learning for text generation
Top 97.2% on sourcepulse
This repository provides code for learning neural templates for text generation, specifically addressing data-to-text tasks. It is targeted at researchers and practitioners in Natural Language Generation (NLG) who are interested in structured prediction and template-based generation methods. The benefit is a novel approach to NLG that combines neural networks with structured prediction for more controllable and interpretable text generation.
How It Works
The core approach utilizes a Conditional Hierarchical Structured Sequence Model (CHSSM) that learns to generate text by first predicting a latent "template" or "skeleton" and then filling in the slots within that template. This structured prediction framework allows for explicit control over the generation process and can lead to more coherent and data-aligned outputs compared to purely end-to-end sequence-to-sequence models. The model is trained using Viterbi training and can extract templates from the learned segmentations.
Quick Start & Requirements
chsmm.py
, template_extraction.py
).-cuda
flag).data/e2e_aligned.tar.gz
) or WikiBio data (data/wb_aligned.tar.gz
). Data preparation scripts are provided.Highlighted Details
Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
The code is explicitly tested with Python 2.7 and PyTorch 0.3.1, which are outdated versions and may present significant compatibility challenges with modern Python environments and PyTorch versions. Training is noted as sensitive to the random seed, potentially requiring multiple runs for optimal performance.
3 years ago
1 week