Abstract
dep_search is a high-performance search engine designed to navigate massive "parsebanks"—collections of billions of words with complex syntactic structures. By combining a flexible, logic-heavy query language with a hybrid backend (Solr and LMDB), the tool allows researchers to find specific grammatical patterns across dozens of languages with unprecedented speed and efficiency.
Introduction
In the world of Natural Language Processing (NLP), we have moved beyond simple keyword searches. Researchers now work with "dependency parsebanks," where every sentence is mapped out as a tree showing how words relate to one another (e.g., which adjective modifies which noun).
As web-crawled datasets grow into the billions of tokens, searching for specific syntactic patterns—like "find every instance of the word 'cat' modified by an adjective that isn't 'orange'"—becomes a massive computational challenge. Previous tools, including the authors' own earlier system (SETS), struggled with scale. They were often slow when dealing with rare words or complex "OR" logic, and their database indexes were prohibitively large.
Methods
The authors introduced several architectural upgrades to transform SETS into dep_search:
The Query Language
Inspired by tools like TGrep, the language supports Boolean logic, nested sub-queries, and linear order constraints. The syntax allows for precise control over structural relationships and token proximity.
Hybrid Backend and Compilation
- Solr: Used for the initial "broad" search. It quickly identifies candidate sentences that contain the right words or tags, regardless of their structure. This effectively solves the "rare word" bottleneck found in older SQLite-based systems.
- LMDB (Lightning Memory-Mapped Database): Once candidates are found, the system pulls the full binary tree data from LMDB.
- Query Compilation: To make structural matching lightning-fast, the system parses the user's query into a tree and then uses Cython to compile that query into native executable code. This allows the fine-grained check of the tree structure to happen at near-hardware speeds.
- Metadata Support: The system can now filter by document-level metadata, allowing users to restrict searches to specific languages, time periods, or sub-corpora.
Datasets and Results
The tool is built to support the Universal Dependencies (UD) framework, a project aimed at consistent grammatical annotation across different languages. The authors host a public server containing all 70 treebanks from Universal Dependencies v2.0, including automatically analyzed parsebank data for 45 different languages. Testing was conducted on indexes containing up to 20 million trees.
Key performance results include:
- Efficiency: The new indexing method reduced disk usage by approximately 50%. An index of 20 million trees now takes up about 45GB.
- Speed: The authors report a major speed-up, particularly for queries involving rare lexical items and complex "OR" statements, which were previously the most computationally expensive.
- Real-world Stress Test: The tool's API is used for automated content validation in the Universal Dependencies project. In the six weeks leading up to the paper, the server processed over 11,000 requests successfully.
Conclusion
dep_search represents a significant leap in the ability to query large-scale linguistic data. By treating structural logic as code to be compiled and utilizing a hybrid database approach, it provides a cross-linguistic utility that allows researchers to compare grammatical patterns across dozens of languages. While the tool is dependent on the quality of the underlying parses and has a learning curve for its query language, its open-source backend and web interface provide a high-performance foundation for the NLP community.
Summary updated