Non-Projective Dependency Parsing using Spanning Tree Algorithms

Ryan T. McDonald, Fernando Pereira, Kiril Ribarov, Jan HajicEMNLP 2005

Abstract

We formalize weighted dependency parsing as searching for maximum spanning trees (MSTs) in directed graphs. Using this representation, the parsing algorithm of Eisner (1996) is sufficient for searching over all projective trees in $O(n^3)$ time. More surprisingly, the representation is extended naturally to non-projective parsing using Chu-Liu-Edmonds (Chu and Liu, 1965; Edmonds, 1967) MST algorithm, yielding an $O(n^2)$ parsing algorithm. We evaluate these methods on the Prague Dependency Treebank using online large-margin learning techniques (Crammer et al., 2003; McDonald et al., 2005) and show that MST parsing increases efficiency and accuracy for languages with non-projective dependencies.

Introduction: The Challenge of Non-Projectivity

In natural language processing, dependency parsing aims to link words to their syntactic arguments, such as connecting a verb to its subject or an adjective to the noun it modifies. For languages like English, these dependency trees are typically projective. A tree is projective if, when the words are written in their linear order, the dependency edges can be drawn above the sentence without any lines crossing.

However, many languages with flexible word orders and rich inflectional morphology—such as Czech, German, or Dutch—frequently exhibit non-projective dependencies. In these cases, long-distance dependencies or displaced constituents result in edges that "cross" when drawn over the sentence.

A non-projective dependency tree for an English sentence, where the edge from 'dog' to 'was' crosses the edge from 'saw' to 'yesterday'.

Historically, parsers often struggled with non-projectivity. Many systems assumed strict projectivity for simplicity, while others used slow exponential algorithms or complex "pseudo-projective" heuristics to handle crossing edges. This paper introduces a framework that searches the entire space of non-projective trees optimally and efficiently.

Methods: Parsing as a Maximum Spanning Tree Problem

The core innovation of this work is modeling dependency parsing as a Maximum Spanning Tree (MST) problem in a directed graph. For a given sentence, the parser constructs a fully connected directed graph where each word (and a special "root" node) is a vertex. Directed edges are created between every possible pair of words.

Edge-Based Factorization

The score of a dependency tree is defined as the sum of the scores of its constituent edges. Each edge $(i, j)$ is assigned a weight $w \cdot f(i, j)$, where $f(i, j)$ is a feature vector (capturing part-of-speech tags, distance, etc.) and $w$ is a learned weight vector.

The sentence represented as a directed graph with weighted edges, where the goal is to find the highest-scoring spanning tree.

Spanning Tree Algorithms

Finding the optimal parse tree then becomes a search for the MST:

  • Projective Parsing: By applying Eisner’s dynamic programming algorithm, the search is restricted to projective trees, running in $O(n^3)$ time.
  • Non-Projective Parsing: By relaxing the projectivity constraint, the problem can be solved using the Chu-Liu-Edmonds algorithm. This greedy, recursive algorithm selects the best incoming edge for each node and resolves cycles through contraction. Remarkably, this non-projective search is more efficient, running in $O(n^2)$ time.

Learning with MIRA

To optimize the weight vector $w$, the authors use the Margin Infused Relaxed Algorithm (MIRA). This online large-margin classifier updates weights to ensure that the correct tree is separated from incorrect ones by a margin proportional to the number of errors. They compare a "Single-best" update against a "Factored" update that decomposes constraints edge-by-edge.

Results and Key Insights

The MST approach was evaluated on the Prague Dependency Treebank (Czech) and the Penn Treebank (English).

  • Efficiency and Accuracy: Counter-intuitively, non-projective parsing is computationally cheaper ($O(n^2)$ vs $O(n^3)$) because it avoids the overhead of maintaining nested structural constraints.
  • Performance on Czech: On the full Czech dataset, the non-projective Factored MIRA achieved 84.4% accuracy, significantly outperforming previous state-of-the-art parsers. On the subset of sentences containing non-projective edges, the advantage was even more pronounced (81.5% vs 74.8% for the projective baseline).
  • Robustness: Even on English data, which is primarily projective, the non-projective parser remained highly competitive (90.2% vs 90.9% for the projective version), demonstrating that the learning model successfully penalizes unlikely crossing edges.

Conclusion and Future Work

This paper demonstrates that framing dependency parsing as an MST problem provides an elegant and efficient solution for non-projective languages. By moving away from heuristic-driven search, the Chu-Liu-Edmonds algorithm guarantees an exact, optimal solution in quadratic time.

A current limitation is the reliance on edge-based factorization, which prevents the use of "higher-order" features (e.g., sibling or grandparent relationships) that would make the MST search NP-hard. Future work may explore labels for dependency types or methods to incorporate richer structural features while maintaining tractability.

Summary updated

BibTeX
@inproceedings{mcdonald2005non,
  author = {Ryan T. McDonald and Fernando Pereira and Kiril Ribarov and Jan Hajic},
  title = {{Non-Projective Dependency Parsing using Spanning Tree Algorithms}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2005},
  url = {https://openreview.net/forum?id=rJN8nGWdbS},
}
Figure