Abstract
Distributional thesauruses identify semantically similar words by analyzing the contexts they share, a principle known as the Distributional Hypothesis. While valuable, generating these thesauruses for massive, billion-word corpora has traditionally been a computationally intensive task, often taking weeks to complete. This paper introduces a highly optimized, context-centric algorithm that reduces this processing time to less than two hours. By focusing on shared contexts rather than exhaustive word-pair comparisons and utilizing efficient data engineering techniques, the authors enable large-scale linguistic analysis on standard hardware.
Introduction
In computational linguistics, the "Distributional Hypothesis" suggests that words appearing in similar contexts tend to have similar meanings. Building a distributional thesaurus involves calculating similarity scores between all pairs of words in a vocabulary based on their contextual overlaps.
As digital text collections (corpora) have grown into the billions of words, the computational cost of this process has become a significant bottleneck. A "naive" approach—comparing every word against every other word across every possible context—is estimated to take nearly 300 days for a 2-billion-word corpus. Even with standard optimizations, researchers often faced wait times of several weeks. This paper addresses this challenge by proposing an algorithmic shift that makes thesaurus generation a routine task within the Sketch Engine toolset.
Methods
The core innovation of this work is a shift from word-centric to context-centric processing.
The Context-First Loop
Instead of the traditional approach of comparing word $A$ to word $B$, the algorithm iterates through every unique context (for example, being the object of the verb "drink"). For each context, it identifies the list of words that appear within it and increments the similarity scores only for the pairs of words found in that specific list.
Leveraging Sparsity and Heuristics
While the theoretical complexity of the problem remains high, the practical complexity is dramatically reduced because language is sparse. Most word pairs share zero contexts. By only processing words that actually share a context, the algorithm ignores the "empty space" that consumes the vast majority of computation time in naive implementations.
Furthermore, the authors employ smart heuristics to skip extremely common contexts (e.g., being the object of the verb "have"). These "high-frequency, low-salience" contexts are computationally expensive to process but contribute very little to distinguishing semantic meaning.
Big Data Engineering
To handle similarity matrices that exceed available RAM, the system utilizes Two-Phase Multi-way Merge Sort (TPMMS) and data partitioning. This allows the processing of hundreds of gigabytes of data using as little as 1GB of RAM per process by efficiently sorting and summing data on disk.
Linguistic Analysis Features
Beyond raw speed, the paper introduces methods for contextualizing linguistic data. The authors argue that a linguistic fact (e.g., "the word constraint is plural 75% of the time") is meaningless in isolation. They introduce grammatical histograms to show how a word behaves relative to its entire word class, providing a visual "baseline" for researchers to identify truly unique usage patterns.
Experimental Evaluation
The algorithm was evaluated using three major corpora: the BNC (100 million words), the Oxford English Corpus (1 billion words), and Itwac (1.9 billion words).
Key Results
The implementation achieved dramatic speedups across all test cases. As shown in the performance data below, the system can process a billion-word corpus in roughly 100 minutes.
Specifically, the Oxford English Corpus (1B words) was processed in approximately 1 hour and 40 minutes. The even larger 1.9B word Itwac corpus took only 1 hour and 16 minutes when using a higher frequency threshold (MIN=20). These results were achieved on standard hardware (AMD Opteron), proving that "Big Data" linguistics does not necessarily require supercomputing resources if the underlying algorithm is sufficiently optimized.
Discussion and Conclusion
The breakthrough presented here focuses primarily on the efficiency of the computation rather than the underlying mathematical model of similarity. The authors utilized existing similarity functions to validate the speed gains.
By flipping the logic of thesaurus construction to focus on contexts and exploiting the inherent sparsity of natural language, the authors have transformed a week-long supercomputing task into a near-real-time process. This advancement allows linguists to explore semantic relationships in billion-word corpora with unprecedented ease and speed, integrated directly into the Sketch Engine platform.
Summary updated