Abstract
Hand-coded grammars often struggle with the "long tail" of linguistic constructions found in large-scale corpora. This paper presents an automated "error mining" technique to identify systematic gaps in such grammars. By calculating a "parsability" metric across millions of unannotated sentences, developers can pinpoint specific n-grams that consistently lead to parser failure. Applying this method to the Alpino Dutch parser resulted in a significant coverage increase from 91.4% to over 95%.
Introduction
Building a wide-coverage grammar for natural language is a monumental task. Traditional methods rely on small, manually annotated treebanks or developer-curated test sets, both of which often fail to capture the diversity of real-world language. Because language follows a Zipfian distribution, rare words and idiosyncratic syntactic constructions are frequent in the aggregate, leading to "coverage gaps" when parsers encounter raw text.
When a parser fails on a sentence, identifying the exact cause—be it a missing lexical entry, a faulty grammar rule, or a tokenization error—is manually intensive. This research proposes an automated method to "mine" these errors from large, unannotated corpora.
The Parsability Metric
The core of the error mining approach is the Parsability metric, $R(w)$. By running a parser on a massive corpus, developers can observe which word sequences (n-grams) appear most frequently in sentences that the parser fails to process.
The metric is defined as the ratio of successful parses containing the n-gram to the total occurrences of that n-gram. As shown in the histogram above, while most n-grams have high parsability, a distinct subset clusters at 0.0. These are "prime suspects" for grammar or lexicon errors. To ensure accuracy, the system only flags an n-gram if its parsability is significantly lower than that of its constituent parts, preventing "innocent" neighboring words from being blamed for a failure.
Implementation and Scalability
Processing millions of sentences to count every possible n-gram is computationally demanding. The authors utilized a combination of Suffix Arrays for efficient substring counting and Perfect Hash Finite Automata to map words to integers. This allowed the system to process a 38-million-word corpus in approximately 15 minutes on contemporary hardware, making it a highly practical tool for iterative grammar development.
Results and Insights
The mining technique successfully identified several classes of errors beyond simple missing vocabulary. These included:
- Tokenization Errors: Sequences like "H. 's" (common in Dutch crime reporting for initials) were frequently mismanaged.
- Lexical Gaps: Words with incorrect gender or category assignments in the dictionary (e.g., kaft).
- Idiomatic Expressions: "Frozen" phrases that do not follow standard syntactic rules.
By addressing the errors highlighted by the mining tool, the coverage of the Alpino parser on Dutch news text improved from an initial 91.4% to over 95%. Furthermore, as the grammar became more robust, overall parsing accuracy on established treebanks also showed steady improvement over time.
Conclusion
Error mining transforms raw, unannotated text into a powerful diagnostic tool for grammar engineering. By focusing on the binary signal of parse success or failure across massive datasets, developers can efficiently navigate the long tail of linguistic variety, moving closer to truly wide-coverage natural language understanding.
Summary updated