Supporting Annotation Layers for Natural Language Processing

Preslav Nakov, Ariel S. Schwartz, Brian Wolf, Marti A. Hearst

Abstract

Researchers at UC Berkeley have developed a framework and a specialized query language (LQL) designed to search through text annotated with multiple, overlapping layers of NLP data. By mapping complex linguistic and ontological hierarchies into a relational database, the system allows researchers to perform sophisticated cross-layer queries—such as finding specific protein interactions within complex syntactic structures—at the scale of millions of documents.

Introduction

Modern Natural Language Processing (NLP) is rarely a single-step process. A typical pipeline involves tokenization, part-of-speech tagging, syntactic parsing, and named entity recognition. Each step adds a "layer" of information to the raw text.

The challenge is that these layers often conflict or overlap. For example, a single word might be part of two different overlapping phrases, or a biological term might need to be viewed through both a linguistic lens (as a Noun Phrase) and an ontological lens (as a "Chemical" in a medical hierarchy). Existing tools like TGrep2 or TIGERSearch are often restricted to tree structures (which can't handle overlaps) or rely on XML storage that doesn't scale well to massive datasets. The authors address the need for a unified, scalable way to represent and query these multi-dimensional annotations.

The Multi-Layered Annotation Model

The authors introduce a data model where every annotation is treated as an interval (start and end positions) within the text. This approach allows for sequential layers, overlapping layers, and hierarchical layers like nested parse trees.

Linguistic annotation layers including Word, Part of Speech (POS), and Shallow Parse.

As illustrated in the figure above, the system can represent multiple linguistic perspectives simultaneously, from basic word tokens to complex shallow parse structures, all mapped to the same underlying text span.

Layered Query Language (LQL)

To interact with this data, the authors developed the Layered Query Language (LQL). LQL is a concise, high-level language designed to mirror the underlying annotation structure. It supports:

  • Gaps: Finding patterns that aren't strictly adjacent.
  • Hierarchical Constraints: Using keywords like BELOW to search through ontologies (e.g., finding any "disease" by searching below the "C" node in the MeSH hierarchy).
  • SQL Integration: LQL queries are automatically translated into complex SQL statements, allowing users to leverage standard database operators like GROUP BY or DISTINCT via a relational database management system (RDBMS) backend.

Integrating Domain Knowledge

One of the most powerful aspects of this framework is its ability to bridge the gap between raw linguistics and semantic knowledge by layering domain-specific ontologies over the text.

Domain-specific annotation layers showing Gene/Protein identifiers and hierarchical Ontology mappings.

By integrating ontologies directly, researchers can write queries that combine syntactic structures with semantic categories. For instance, one could find a Noun Phrase that ends with a term categorized under a specific chemical hierarchy in MeSH. This makes complex biological extraction patterns (like protein-protein interactions) significantly easier to express.

Evaluation and Scalability

The system was evaluated using a massive collection of 1.4 million MEDLINE abstracts, resulting in roughly 10 million sentences and 320 million multi-layered annotations. The total database size reached approximately 70 GB.

Key results include:

  • Scalability: The system successfully indexed and queried a 70GB dataset, demonstrating that standard SQL databases can handle hundreds of millions of overlapping annotations when using specialized composite indexes.
  • Performance: Simple queries typically return results in less than a minute.
  • Abstraction: LQL acts as a vital abstraction layer, making queries that would require dozens of error-prone SQL joins human-readable.

Conclusion and Future Work

This research demonstrates that relational databases are a viable and scalable backend for complex NLP structures. While simple queries are fast, the authors admit that complex queries can still face latency issues, requiring further investigation into query optimization. Future work will focus on refining the indexing architecture to handle even more complex, multi-level annotation structures and releasing the software to the broader research community.

Summary updated

BibTeX
@inproceedings{nakov2005supporting,
  author = {Preslav Nakov and Ariel S. Schwartz and Brian Wolf and Marti A. Hearst},
  title = {{Supporting Annotation Layers for Natural Language Processing}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2005},
}
Figure