Abstract
Quantity extraction in natural language processing has traditionally focused on isolated physical measurements and scientific units. However, real-world text, particularly in news and finance, requires understanding the broader context of a quantity—what is being measured, whether it represents a change, and the specific concept it describes. This paper introduces the Comprehensive Quantity Extractor (CQE), a framework that utilizes dependency parsing and BERT-based disambiguation to extract a four-part representation of quantities: Value, Unit, Change, and Concept. Evaluated on the new NewsQuant benchmark, CQE significantly outperforms existing tools and large language models, setting a new state-of-the-art for context-aware quantity extraction.
Introduction: Beyond Simple Measurements
Information Extraction (IE) has made significant strides in identifying entities like names, dates, and locations. Yet, "quantity extraction" has remained surprisingly narrow, often restricted to scientific SI units or simple numeric patterns. In a sentence like "The DAX fell 2% while the S&P gained more than 2%," traditional extractors might identify "2%" twice but fail to capture the crucial context: the subject being measured (DAX vs. S&P) and the direction of the movement (fell vs. gained).
Furthermore, many real-world quantities involve non-scientific units—such as "100 people" or "5 bananas"—which are frequently ignored by standard scientific extractors. As shown in Figure 1, CQE is designed to handle a much broader range of features than its predecessors, including negative values, fractions, ranges, and noun-based units.
The CQE Framework
CQE represents quantities as a structured tuple $(v, u, ch, cn)$, where $v$ is the value, $u$ is the unit, $ch$ is the change indicator, and $cn$ is the concept. The system employs a hybrid multi-stage pipeline:
- Syntactic Extraction via Dependency Parsing: Instead of relying on brittle regular expressions, CQE leverages the grammatical structure of sentences. By using dependency parsing and Part-of-Speech (POS) tagging, the system can identify complex relationships, such as "shared units" (e.g., in "the price rose from 5 to 10 dollars," identifying that both numbers refer to "dollars").
- Concept Detection: This novel module uses prioritized heuristics to find the noun phrase a quantity describes. It inspects the subtrees of the dependency tree to link values to their subjects (e.g., linking "2%" to "DAX").
- Unit Disambiguation: To resolve ambiguous surface forms (e.g., "C" meaning Celsius or Coulomb; "pound" meaning weight or currency), CQE employs a BERT-based classifier trained on context-rich sentences.
- Normalization: The system standardizes values (e.g., converting "10k" to 10,000) and units using a dictionary of 531 predefined types.
Datasets and Evaluation
The researchers introduced NewsQuant, a benchmark consisting of 590 sentences from diverse news categories including economics, sports, and technology. It is the first comprehensive evaluation set specifically designed for value, unit, change, and concept extraction. Additionally, the authors re-annotated existing datasets (R-Txt) for fair comparison and generated a synthetic disambiguation dataset of 1,835 sentences using ChatGPT to train the BERT unit-classifier.
Results and Discussion
CQE demonstrates substantial performance gains over established libraries like Quantulum3 and Microsoft’s Recognizers-Text, as well as few-shot LLMs like GPT-3.
As detailed in Figure 6, CQE achieved an F1-score of 92.0 for value detection and 85.6 for the combined value and unit extraction on the NewsQuant benchmark. In contrast, GPT-3 suffered from "extreme hallucination," often failing to normalize values correctly or confusing multipliers (like "billion") with units. CQE's grammar-aware approach proved far more reliable for precise extraction tasks. Furthermore, the BERT-based disambiguation module achieved an average F1 of 88.1, significantly outperforming the rule-based logic found in tools like Quantulum3.
Conclusion
CQE provides a robust, context-aware solution for quantity extraction. By moving beyond simple pattern matching to a syntactically informed model, it captures the essential "behavior" of numbers in text. While currently dependent on the accuracy of underlying dependency parsers like SpaCy, CQE sets a new standard for extracting structured quantitative data from unstructured text, paving the way for more sophisticated downstream tasks in financial analysis and knowledge graph construction.
Summary updated