Efficient Indexing and Querying over Syntactically Annotated Trees

Pirooz Chubak, Davood Rafiei · DOI

Abstract

As natural language processing (NLP) matures, the demand for querying the grammatical structure of large text corpora has grown. Traditional keyword-based search is often insufficient for capturing complex linguistic relationships. This paper presents a high-performance indexing scheme designed for searching syntactically parsed text. By indexing unique subtrees and employing a novel "root-split" coding technique, the authors achieve query response times an order of magnitude faster than existing state-of-the-art systems while significantly reducing index overhead.

The Challenge of Structural Querying

Modern NLP tools can transform sentences into hierarchical trees that identify subjects, verbs, and objects. This structural representation enables precise queries, such as finding all instances where a specific noun is defined as a certain type of animal. However, querying these structures at scale presents a significant bottleneck. Existing solutions often require loading entire corpora into memory or rely on relational databases that suffer from "join explosion" when reconstructing tree relationships.

Figure 4: A sample structural query (a) and a matching sentence parse tree (b) illustrating the complexity of tree-based search.

The challenge lies in storing these complex tree structures compactly while allowing for lightning-fast retrieval across massive datasets.

Proposed Methodology

The authors introduce two primary innovations to address these scalability issues:

  1. Subtree Index (SI): Rather than indexing every individual node, the system indexes unique subtrees up to a maximum size (mss). This approach leverages the inherent redundancy in natural language, where similar grammatical structures repeat frequently.
  2. Root-Split Coding: This technique optimizes index storage by only recording positional information (pre-order, post-order, and level) for the root of a subtree. Since the index key itself represents the internal structure, storing it for every node is redundant. This optimization reduces index size by 50% to 80% compared to standard interval coding.

To handle queries larger than the indexed subtrees, the researchers developed algorithms like optimalCover to decompose complex queries into indexed components and efficiently join them.

Scalability and Efficiency

The system was evaluated using the AQUAINT news corpus and various query sets. A key observation was that the number of unique subtrees in natural language grows slowly and predictably relative to the total number of nodes.

Figure 6: The number of unique subtrees grows linearly with the number of parsed sentences across different maximum subtree sizes (mss).

As shown in the evaluation, the system demonstrates near-linear scaling. When increasing the corpus from 1,000 to 1,000,000 sentences, query runtimes remained predictable, outperforming previous methods like ATreeGrep and TreePi by at least 10x.

Key Insights and Conclusion

The success of this approach stems from exploiting the "well-behaved" nature of human language parse trees, which typically have small branching factors (averaging around 1.52). By moving from node-level indexing to subtree-level indexing, the system avoids the performance penalties associated with excessive joins.

In summary, the combination of Subtree Indexing and Root-Split Coding provides a robust framework for large-scale linguistic search. Future work may involve integrating advanced structural join algorithms and statistics-based query optimizers to further refine performance on highly complex queries.

Summary updated

BibTeX
@article{chubak2012efficient,
  author = {Pirooz Chubak and Davood Rafiei},
  title = {{Efficient Indexing and Querying over Syntactically Annotated Trees}},
  journal = {Proc. VLDB Endow.},
  year = {2012},
  doi = {10.14778/2350229.2350249},
}
Figure