A Modular Approach for Multilingual Timex Detection and Normalization using Deep Learning and Grammar-based methods

Nayla Escribano, German Rigau, Rodrigo Agerri · DOI

Abstract

Temporal expression (Timex) processing is a critical task in Natural Language Processing, involving the detection of time-related phrases and their normalization into standardized formats. Traditional systems often rely on monolithic, rule-based architectures that are difficult to adapt across languages. This paper presents a modular system that leverages the strengths of deep learning for detection and formal grammars for normalization. By utilizing XLM-RoBERTa for multilingual detection and extending the TimeNorm framework with the first-ever Spanish grammar, the proposed system achieves state-of-the-art performance on standard benchmarks.

Introduction

In the field of Natural Language Processing (NLP), processing temporal expressions (Timex) involves two distinct challenges: detection (identifying spans like "two days ago") and normalization (converting them to ISO-like formats such as 2023-10-25). While deep learning has significantly improved detection, normalization remains a stronghold for rule-based systems due to the need for strict logical and arithmetic consistency.

Most existing multilingual tools, such as HeidelTime, are "monolithic," intertwining detection patterns with normalization rules. This coupling makes them rigid and difficult to extend to new domains or languages. This research addresses these limitations by proposing a decoupled, modular architecture.

Methodology

The proposed system, XTN, treats detection and normalization as independent components, allowing for targeted improvements in either area.

Detection: The Neural Component

The detection module utilizes XLM-RoBERTa, a large-scale multilingual Transformer model. The researchers fine-tuned this model to identify time expressions across multiple languages. A key finding was that joint training on English and Spanish data simultaneously yielded superior results compared to monolingual training, suggesting that the model benefits from shared cross-lingual temporal concepts.

Normalization: The Grammar-based Component

For normalization, the system employs TimeNorm, which is based on Synchronous Context-Free Grammars (SCFG). This approach allows for precise mapping between natural language and structured temporal representations. A major contribution of this work is the development of the first comprehensive TimeNorm grammar for Spanish.

The modular architecture of the XTN system, decoupling detection and normalization.

The modularity of XTN allows the detector to be upgraded with newer neural architectures without affecting the normalization logic. Conversely, the grammar can be refined to handle cultural nuances in time expression without retraining the neural model.

Example of a Synchronous Context-Free Grammar (SCFG) mapping a Spanish source tree to a normalized target tree.

Experimental Evaluation

The system was evaluated using standard benchmarks, including TempEval-3 (TE3) and the MEANTIME (MT) parallel corpus. To facilitate future research, the authors also released a new TempEval-3 compatible evaluator designed for tabulated text.

Key Results

The modular XTN approach demonstrated significant improvements over the baseline HeidelTime:

  • Gold Normalization: When provided with correct text spans, XTN achieved 78.99% accuracy on English TE3, compared to HeidelTime's 74.64%.
  • Detection and Classification: The XLM-RoBERTa detector outperformed hand-crafted patterns in both finding expressions and correctly identifying their types (DATE, TIME, DURATION, SET).
  • Spanish Benchmarks: The new Spanish grammar matched or exceeded state-of-the-art results across nearly all Spanish-language tests.

Discussion and Insights

A notable observation is the difference between "conservative" and "high coverage" strategies. HeidelTime often ignores complex expressions it cannot normalize, which can artificially inflate certain precision metrics. In contrast, XTN aims for high coverage, detecting all expressions. While this is more useful for downstream information extraction, it can lead to lower combined scores if the normalizer cannot resolve the most complex cases.

Furthermore, the development of the Spanish grammar prioritized linguistic coherence over simple benchmark optimization. By focusing on how time is culturally and linguistically structured (e.g., the perception of "midday"), the resulting grammar is more robust for general-purpose use.

Conclusion and Future Work

This modular approach successfully combines the flexibility of deep learning with the precision of formal grammars. Future research will focus on improving contextual disambiguation for vague expressions and developing strategies to handle highly ambiguous cases that currently resist normalization. While the modular design simplifies expansion, the creation of formal grammars remains a manual task required for scaling to additional languages.

Check out the code: The authors have made their Spanish grammar and system code publicly available on GitHub (timenorm-es and XTN-timexes).

Summary updated

BibTeX
@article{escribano2023modular,
  author = {Nayla Escribano and German Rigau and Rodrigo Agerri},
  title = {{A Modular Approach for Multilingual Timex Detection and Normalization using Deep Learning and Grammar-based methods}},
  journal = {Knowledge-Based Systems},
  year = {2023},
  doi = {10.1016/j.knosys.2023.110612},
}
Figure