Graph-Structured Stack and Natural Language Parsing

Masaru TomitaACL 1988

Abstract

Natural language parsing is inherently complex due to the pervasive ambiguity of human speech. Traditional stack-based parsers often struggle with nondeterministic choices, leading to exponential time complexity or inefficient backtracking. This paper introduces the Graph-Structured Stack (GSS), a generalized data structure that reimagines the linear stack as a directed acyclic graph. By allowing stack nodes to split, combine, and pack, the GSS enables parsers to handle multiple interpretations simultaneously in polynomial time. This innovation not only improves parsing efficiency but also provides a unified framework for understanding disparate parsing algorithms, such as chart parsing and generalized LR parsing.

Introduction

In the realm of computer science, parsing formal languages like C++ or Java is a well-understood problem. These languages are designed to be unambiguous, allowing a simple linear stack to track the state of the parser. However, natural language is fundamentally different. A single sentence can often yield multiple valid syntactic structures—a phenomenon known as ambiguity. For example, in the sentence "I saw the man with the telescope," it is unclear whether the speaker or the man possesses the telescope.

Masaru Tomita's seminal work addresses this challenge by introducing the Graph-Structured Stack (GSS). The GSS serves as a general-purpose device for any system that uses a stack nondeterministically, ensuring that the parser never performs redundant work.

The Problem: Nondeterminism and Complexity

Traditional parsers encounter "nondeterministic" points where multiple grammatical rules could apply. To handle this, they typically employ one of two strategies:

  1. Backtracking: The parser picks one path and, if it fails, returns to the choice point to try another.
  2. Parallel Stacks: The parser maintains multiple independent stacks for every possible interpretation.

Both methods are computationally expensive. In the worst-case scenario, the number of paths to explore grows exponentially with the length of the sentence, making real-time natural language processing (NLP) impractical. Tomita's goal was to find a way to merge these paths whenever possible, reducing the search space to polynomial complexity.

The Graph-Structured Stack (GSS)

The core innovation of the GSS is its ability to represent multiple stack states within a single directed acyclic graph. This is achieved through three fundamental operations:

  • Splitting: When a parser state allows for multiple possible reductions (pops), the top of the stack "splits" into multiple nodes, each representing a different path.
  • Combining: If the same symbol needs to be pushed onto multiple different stack tops, the GSS merges those tops into a single node, avoiding the creation of redundant stack branches.
  • Local Ambiguity Packing: When two different branches of the stack reach the same state after processing the same input, they are merged. This "packing" ensures that subsequent parsing steps are only performed once for that state.
The GSS allows branches to split and then merge (pack) back together, preventing redundant computations.

By utilizing these operations, the GSS effectively "memoizes" the parsing process, ensuring that identical sub-problems are solved only once.

Applications and Unification

The GSS is not tied to a single parsing algorithm; rather, it is a versatile structure that can be integrated into various frameworks. Tomita demonstrates its utility across several paradigms:

  • Generalized LR Parsing: Extending standard compiler parsing techniques to handle ambiguous grammars.
  • Augmented Transition Networks (ATN): Managing local registers and return addresses efficiently.
  • Categorial Grammars: Applying the GSS to constraint-heavy linguistic theories.
A Graph-Structured Stack applied to ATN parsing for the sentence "I saw a man," showing how states and registers are managed.

One of the most profound insights of the paper is the unification of parsing theories. Tomita proves that chart parsing—a widely used method that stores intermediate results in a table—is essentially a specific implementation of shift-reduce parsing using a GSS. This realization suggests that many seemingly different parsing algorithms are actually variations of the same underlying mechanism.

Conclusion

The introduction of the Graph-Structured Stack marked a significant milestone in computational linguistics. By providing a theoretical guarantee of polynomial time complexity for ambiguous grammars, Tomita paved the way for more robust and efficient NLP systems. The GSS remains a cornerstone of modern parsing theory, illustrating how elegant data structures can solve complex algorithmic bottlenecks. While the original paper focused on theoretical foundations, the GSS has since found applications in diverse fields, from programming language research to complex pattern matching in large datasets.

Summary updated

BibTeX
@inproceedings{tomita1988graph,
  author = {Masaru Tomita},
  title = {{Graph-Structured Stack and Natural Language Parsing}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {1988},
  doi = {10.3115/982023.982054},
}
Figure