SETS: Scalable and Efficient Tree Search in Dependency Graphs

Juhani Luotolahti, Jenna Kanerva, Sampo Pyysalo, Filip GinterNAACL 2015

Abstract

SETS is a high-performance search engine specifically designed for dependency-parsed text and massive "parsebanks" containing billions of words. By compiling linguistic queries into optimized C code and using bitwise operations, it achieves speeds up to 100x faster than existing tools while supporting complex morphological queries.

1. Introduction

As NLP has shifted from small, manually annotated "treebanks" to massive, automatically generated "parsebanks," traditional search tools have struggled to keep up. Older standards like TGrep2 and TRegex were designed for constituency trees (phrase structures) and simple part-of-speech tags. They often fail when faced with modern dependency graphs, morphological richness in languages like Finnish or Czech, and the sheer scale of datasets containing hundreds of millions or billions of words. Existing tools often hit a performance wall at the one-million-word mark.

2. Methodology

The core innovation of SETS is its query-to-native-code pipeline. Instead of interpreting a query string at runtime, the system compiles user queries into a sequence of set operations (intersections, complements, etc.), which are then converted into C code via the Cython compiler.

Table of SETS query operators and their meanings.

The system utilizes bitwise optimization, representing sentences as native integers where each bit corresponds to a token position. This allows the engine to evaluate complex relations using lightning-fast bitwise logic (AND, OR, NOT). Storage is managed via an embedded SQLite database for pre-indexed token sets, making the system self-contained. The query language is expressive, supporting negation, universal quantification, and directional constraints.

3. Evaluation and Results

The authors evaluated SETS using Universal Dependencies (UD) treebanks across 10 languages and a massive custom parsebank consisting of 10 million trees (over 120 million tokens).

The SETS search interface displaying dependency-parsed sentences.

In head-to-head tests against ICARUS, a state-of-the-art baseline, SETS demonstrated a massive speedup. For a standard query on 90,000 sentences, SETS finished in 1.61 seconds, compared to 150 seconds for ICARUS—a nearly 100x improvement. On the 120-million-token dataset, complex queries were executed in under 2 minutes. Furthermore, the indexing is compact; a 10-million-sentence parsebank requires approximately 35GB of disk space.

4. Discussion and Future Work

SETS treats queries as programs, bypassing the overhead of traditional interpreters. Its efficiency allows sophisticated linguistic research on low-end hardware. However, limitations remain, such as the lack of full support for "co-indexing" in non-tree graphs. Future work includes extending the system to support multiple layers of annotation (e.g., semantic labels) and exploring dynamic updates for real-time corpora additions.

Summary updated

BibTeX
@inproceedings{luotolahti2015sets,
  author = {Juhani Luotolahti and Jenna Kanerva and Sampo Pyysalo and Filip Ginter},
  title = {{SETS: Scalable and Efficient Tree Search in Dependency Graphs}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2015},
  doi = {10.3115/v1/n15-3011},
}
Figure