TransLIST: A Transformer-Based Linguistically Informed Sanskrit Tokenizer

Jivnesh Sandhan, Rathin Singha, Narein Rao, Suvendu Samanta, Laxmidhar Behera, Pawan Goyal · DOI

TL;DR

This paper introduces TransLIST, a novel Transformer-based tokenizer for Sanskrit that effectively handles the language's complex sandhi phenomenon. By combining linguistic knowledge with deep learning, TransLIST achieves state-of-the-art performance in Sanskrit Word Segmentation, outperforming previous methods by a significant margin.

What Problem Does This Paper Address?

Digitizing ancient texts, like those in Sanskrit, is crucial for preserving cultural heritage. However, making these texts usable for computational tasks is challenging due to linguistic complexities. One such challenge is Sanskrit Word Segmentation (SWS), which is complicated by the "sandhi" phenomenon. Sandhi causes characters at word boundaries to change phonetically, making it difficult to identify where one word ends and another begins.

Existing approaches fall into two camps:

  1. Lexicon-driven methods: These use tools like the Sanskrit Heritage Reader (SHR) to generate potential word splits. While good at handling known words, they struggle with words not present in their lexicon (out-of-vocabulary tokens).
  2. Purely engineering methods (deep learning): These are more flexible and can handle unseen words but often ignore valuable linguistic information like potential word boundaries suggested by lexicons.

This paper aims to bridge this gap by creating a system that leverages both linguistic insights and the power of deep learning, offering a robust solution for SWS.

Methods

The proposed system, TransLIST, is built around a Transformer architecture and incorporates three key novel components:

  1. Linguistically Informed Tokenization Module (LIST): This module encodes character inputs along with "latent-word information." This latent information comes from the SHR tool, providing potential word candidates even if they are partially formed or incomplete. This helps the model learn to handle sandhi-specific transformations. In cases where SHR provides no candidates, TransLIST falls back to using n-grams (sequences of n characters) to provide some linguistic context.
  2. Soft-Masked Attention (SMA): Standard Transformer attention can be computationally intensive and may not effectively prioritize relevant candidate words. SMA introduces a "soft mask" that helps the model focus on candidate words that are most likely to contain the current input character, while still allowing interactions between all candidates. This injects inductive bias, guiding the model towards better predictions.
  3. Path Ranking for Corrupted Predictions (PRCP): Sometimes, even with the best models, predictions might not align perfectly with the available candidate solutions. The PRCP module addresses this by re-ranking potential segmentation paths. It uses a scoring function that considers the likelihood of a path according to TransLIST, the perplexity from a character-level language model, and a penalty for paths with too many words, encouraging more concise segmentations.

Datasets

The paper evaluates TransLIST on two benchmark datasets for Sanskrit Word Segmentation:

  • SIGHUM: A dataset derived from the Digital Corpus of Sanskrit (DCS).
  • Hackathon: Another dataset also derived from DCS.

Both datasets provide ground truth segmentations and candidate solution spaces generated by the Sanskrit Heritage Reader (SHR).

Key Insights and Ideas

  • The power of combining approaches: The core insight is that neither purely lexicon-driven nor purely engineering-based methods are sufficient for Sanskrit Word Segmentation. TransLIST demonstrates that a hybrid approach, integrating linguistic knowledge (from SHR) into a deep learning framework, yields superior results.
  • Handling sandhi is key: The paper emphasizes that sandhi is the primary obstacle in SWS. TransLIST's LIST module is specifically designed to learn and account for these character transformations at word boundaries.
  • Inductive bias matters: The Soft-Masked Attention (SMA) module is crucial for injecting prior knowledge into the Transformer. This helps the model prioritize relevant candidates, especially in low-resource settings where learning everything from scratch is difficult.
  • Correcting mistakes is vital: The PRCP module highlights the importance of a post-processing step to refine predictions. Even advanced models can make errors, and a well-designed ranking mechanism can significantly improve accuracy by leveraging available linguistic resources.
  • SHR is beneficial, but not essential: While TransLIST performs best when SHR candidate spaces are available, the TransLISTngrams variant shows that the system can still achieve competitive results even without this external resource, making it adaptable.

Key Results

TransLIST achieves state-of-the-art performance on both the SIGHUM and Hackathon datasets.

  • Overall Gain: TransLIST achieves an average absolute gain of 7.2 points in the Perfect Match (PM) metric over the best previous state-of-the-art systems.
  • Specific Gains: It outperforms the best baseline systems (rcNN-SS on SIGHUM and FLAT-Lattice on Hackathon) by an average of 1.8 points (F1-score) and 7.2 points (PM).
  • Robustness without SHR: Even without the SHR candidate space (TransLISTngrams), the system provides an average gain of 0.11 points (F1-score) and 0.39 points (PM) over the best baselines, demonstrating its effectiveness as a purely engineering approach.
  • Ablation Studies: Experiments show that each component (LIST, SMA, PRCP) contributes significantly to TransLIST's performance. The LIST module is identified as particularly crucial for injecting inductive bias.
  • Performance on Ambiguous Rules: TransLIST shows significant improvements over the state-of-the-art, especially for rare sandhi rules that lead to ambiguous surface characters.
  • Sentence Length Robustness: TransLIST is shown to be more robust to varying sentence lengths compared to other systems, maintaining performance on longer sentences.

Limitations and Future Work

  • Dependency on SHR: A key limitation for TransLIST's full capability is its reliance on a lexicon-driven shallow parser like SHR for optimal performance. Extending TransLIST to languages lacking such parsers would require developing similar tools or relying solely on the TransLISTngrams variant.
  • Future Work: The authors plan to extend this work to morphological tagging and multi-task settings, integrating SWS with other linguistic tasks. They also suggest exploring ways to optimize the inference time of the PRCP module and investigating if TransLIST and TransLISTngrams can be effectively used together.

Summary updated

BibTeX
@inproceedings{sandhan2022translist,
  author = {Jivnesh Sandhan and Rathin Singha and Narein Rao and Suvendu Samanta and Laxmidhar Behera and Pawan Goyal},
  title = {{TransLIST: A Transformer-Based Linguistically Informed Sanskrit Tokenizer}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.findings-emnlp.513},
}
Figure