Abstract
SanskritShala is the first neural-based NLP toolkit for Sanskrit that integrates state-of-the-art models for word segmentation, morphological tagging, dependency parsing, and compound identification into a single, user-friendly web interface. By combining deep learning with traditional linguistic rules, it provides a powerful platform for both students learning the language and researchers building the next generation of Sanskrit datasets.
Introduction
Sanskrit is a "low-resource" language in the AI world, but it is linguistically one of the most complex. It features the sandhi phenomenon (where word boundaries transform when joined), a massive system of 40,000+ possible morphological labels, frequent compounding, and a very flexible word order.
Existing tools for Sanskrit generally fall into two camps: rule-based systems that are precise but struggle with "out-of-vocabulary" words, and manual annotation tools that offer no automated help. SanskritShala addresses this gap by providing a neural-based "human-in-the-loop" system. It uses deep learning to make predictions but allows users to interactively correct them, making the process of analyzing ancient texts faster and more accurate.
Methodology
The toolkit consists of four primary neural modules, each designed to handle a specific linguistic challenge.
1. TransLIST (Tokenizer)
A Transformer-based model that handles word segmentation. It is "linguistically informed," meaning it doesn't just guess where words end; it uses a rule-based system (the Sanskrit Heritage Reader) to generate a space of possible candidates and then uses a soft-masked attention (SMA) mechanism to pick the best one.
2. LemmaTag (Morphological Tagger)
This module uses a multi-task learning framework with bidirectional RNNs. It simultaneously predicts the "lemma" (the base form of a word) and its morphological tags (gender, case, number, etc.) using both character-level and word-level representations.
3. Ensembled Dependency Parser and SaCTI (Compound Identifier)
To handle the lack of labeled data, the authors used an ensemble strategy including data augmentation and a novel pretraining task called LCM (Lemma, Case, and Morphological tag prediction). This helps the parser understand the syntactic structure of a sentence even with limited training examples.
Sanskrit is also famous for long compound words. The SaCTI module uses a multi-task approach that incorporates information from the morphological and dependency modules to identify the semantic relationship between components of a compound.
Datasets and Evaluation
The authors utilized several benchmark datasets for training and evaluation, including the Digital Corpus of Sanskrit (DCS). Beyond the models, they released significant new resources:
- 7 Pretrained Word Embeddings: Including static models (word2vec, GloVe, fastText) and contextualized models (ELMo, ALBERT, and their own LCM).
- 4 Intrinsic Evaluation Datasets: New benchmarks for Sanskrit word similarity, relatedness, categorization, and analogy prediction to help other researchers measure the quality of their word embeddings.
Results and Key Insights
SanskritShala's modules currently report state-of-the-art (SOTA) performance across all four tasks:
- Word Segmentation: Achieved a 93.97% Perfect Match (PM) score.
- Morphological Tagging: Ranked 1st on the Hackathon leaderboard with a 69.3 F1-score.
- Dependency Parsing: Reached an 88.67 Unlabelled Attached Score (UAS).
- Compound Identification: Achieved an 81.7 F1-score.
Hybrid Neural-Rule Systems
The "aha moment" here is that deep learning doesn't have to replace rule-based systems. By using rule-based systems to define a "candidate space" and neural models to rank those candidates, the authors achieved significantly higher accuracy than using either method in isolation. Furthermore, in low-resource settings, forcing the models to learn auxiliary tasks like case and lemma prediction (the LCM pretraining) provides essential linguistic anchors.
Limitations and Future Work
The authors note that while the system is robust for prose, it is "fragile" when applied to Sanskrit poetry. Because poetry often uses highly non-standard word orders to fit metrical constraints, the dependency parser's performance drops significantly in this domain.
Future work aims to expand the toolkit to include post-OCR correction (fixing errors from scanned manuscripts), Named Entity Recognition (NER), and machine translation for word order linearization (converting poetic word order back into standard prose).
Summary updated