Exploring Chunk Based Templates for Generating a subset of English Text

Nikhilesh Bhatnagar, Manish Shrivastava, Radhika MamidiACL 2018

Introduction

Natural Language Generation (NLG) is traditionally divided into two distinct phases: Strategic Generation, which determines the content of the message, and Tactical Generation, which handles the linguistic realization. While modern neural models have made significant strides, they often require massive datasets and can still produce "word salad" when constraints are tight. Conversely, traditional template-based systems ensure high quality but suffer from poor scalability and high manual labor costs.

This research, originally presented at ACL 2018, proposes a middle ground between rigid templates and fluid word-level generation. By using "chunks"—small, sub-sentence linguistic units—the system leverages the inherent grammaticality of real-world text while maintaining the flexibility to generate novel sentences.

Methodology

The proposed pipeline consists of three primary stages: extraction, pruning, and search.

System Architecture: From Wikipedia corpus to final sentence generation.

Template Extraction & Abstraction

The system begins by extracting chunks from the English Wikipedia corpus. To manage the vast diversity of natural language and prevent a "vocabulary explosion," the authors implement an abstraction layer. Instead of storing raw tokens, chunks are converted into templates where specific words are replaced by Part-of-Speech (POS) tags, Named Entity tags, or "Cluster IDs" derived from K-Means clustering on word embeddings.

Examples of chunk features and their corresponding abstracted templates.

As shown in the table above, a phrase like "a popular wrestler" can be abstracted into various templates, such as "a, JJ213, NN5266" or simply "DT, JJ, NN". This allows the system to generalize across similar syntactic structures and significantly reduces the search space.

Fitness Function

To evaluate the quality of a generated sequence, the authors developed a fitness function ($F$) comprising five N-gram language model scores:

  • Extended Chunk Score: Evaluates global syntactic structure.
  • Construction Score: Assesses the internal layout of the chunk.
  • Junction Score: Measures how well two templates "glue" together at their boundaries.
  • Head Score: Captures semantic and syntactic interactions between the primary words of adjacent chunks.
  • Lexical Score: Provides a baseline for word-level grammaticality.

Given the astronomical number of possible template combinations, a brute-force search is impossible. The authors utilize an evolutionary algorithm starting with a population of 1,000 potential sentences. Through successive generations of mutation and elitist selection, the population evolves toward higher fitness scores. To ensure structural variety and prevent the model from defaulting to the most common (and often boring) syntactic patterns, a Zipf-based sampling technique is applied to dampen the distribution of templates.

Datasets and Implementation

The English Wikipedia corpus served as the primary data source. The text was processed using Stanford CoreNLP for tokenization and POS tagging, while spaCy and LM-LSTM-CRF were used for chunking. Word embeddings for clustering were generated using lexvec.

Key Insights

The central hypothesis is that starting with grammatical chunks shifts the generation task from constructing grammar to preserving it. By abstracting these chunks, the search space becomes navigable for an evolutionary algorithm. Furthermore, the inclusion of a dampening exponent for Zipfian distributions was crucial; without it, the system tended to produce repetitive, overly simplistic structures.

Results

The system demonstrated the ability to generate coherent and syntactically complex sentences under specific constraints. For instance, when tasked with including the word "cat," the system produced: "the heated water plant is likewise formed entirely of cat." While semantically unusual, the sentence is syntactically sound. In another test requiring a "wh-word" and a question mark, it generated: "what does the right thing do?"

Quantitatively, the system generated sentences in approximately 150 seconds using 2.2 GB of memory. While slower than some end-to-end neural models, it offers a transparent and controllable alternative for tactical generation.

Conclusion and Future Work

This chunk-based approach provides a robust framework for generating grammatical text from non-linguistic data. Future improvements could focus on reducing the need for human supervision in specifying word positions and improving search scalability for longer sentences. Additionally, integrating an automated content selection module would move the system closer to a fully autonomous NLG solution.

Summary updated

BibTeX
@inproceedings{bhatnagar2018exploring,
  author = {Nikhilesh Bhatnagar and Manish Shrivastava and Radhika Mamidi},
  title = {{Exploring Chunk Based Templates for Generating a subset of English Text}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2018},
  url = {https://openreview.net/forum?id=rkVa1pxdWH},
}
Figure