Abstract
The Aṣṭādhyāyī of Pāṇini contains approximately 1,115 rules (A.4.1.76 to A.5.4.160) dedicated to the generation of derivative nouns, known as the Taddhita section. This section systematically enumerates affixes used in derivations under specific semantic relations. We propose an automated system for generating these derivative nouns by simulating Pāṇini’s logic through an object-oriented approach. By modeling rules as classes and grouping them via anuvṛtti (contextual carry-over), we create an inheritance network. The system utilizes multilevel inheritance and the Observer design pattern to manage rule application and conflict resolution. Our evaluation shows high accuracy and validates the effectiveness of modeling the Aṣṭādhyāyī as a programmatic system.
Introduction
Sanskrit grammar is famously algorithmic, yet its automation remains a significant challenge. The Taddhita section is particularly complex due to its massive rule set and the intricate dependencies between them. Existing tools often focus on simple analysis, but generating derivative nouns (e.g., deriving "Aupagava" from "Upagu") requires a precise simulation of the step-by-step derivation process (prakriyā). This involves managing "head rules" (adhikāra) that govern subsequent rules and resolving conflicts when multiple rules are applicable.
Methodology: Modeling Ancient Grammar as Software
The proposed system treats Pāṇini’s grammar as a software architecture, mapping linguistic principles to modern design patterns:
- Object-Oriented Rule Modeling: Each grammatical rule is encapsulated as an individual class.
- Inheritance via Anuvṛtti: Rules in the Aṣṭādhyāyī often inherit context from preceding ones. This is modeled using Multilevel Inheritance, resulting in a Directed Acyclic Graph (DAG) of rule groups. A "head rule" defines the general environment, and child rules refine it.
- Observer Design Pattern: To efficiently trigger rules, the system treats the "derivation environment" (the word state) as a Subject. When the word changes, it notifies relevant "Observer" rules to check for applicability.
Conflict Resolution and Implementation
A critical aspect of the system is resolving rule conflicts. The authors implemented two primary mechanisms:
- Vipratiṣedha: The traditional Pāṇinian principle where the later rule in the text takes precedence.
- Specificity Hierarchy: A more advanced logic that prioritizes rules based on linguistic depth: Semantic rules > Morphological > Phonological > Phonetic. Incorporating this hierarchy was a key factor in boosting system performance.
Results and Evaluation
The system was evaluated against 60 input cases covering the apatya (descendant) section. Five Sanskrit experts performed a binary evaluation of the outputs.
- Accuracy: Using only standard rule ordering (vipratiṣedha), the system achieved 83.33% accuracy. Incorporating the Specificity Hierarchy improved this to 93.33%.
- Derivation Traces: A key feature is the generation of a full "trace," showing every rule applied during the derivation. This provides significant pedagogical value for students, as it mirrors the traditional prakriyā method.
Conclusion and Future Work
The study demonstrates that Pāṇini’s 5th-century BCE linguistic structures map effectively onto modern software design patterns. While the system currently struggles with rules dependent on speaker intention (e.g., "reproach"), it provides a robust foundation for a generic Pāṇinian engine. Future work aims to expand the system to the entire Taddhita section and eventually the full Aṣṭādhyāyī, while modeling "meta-rules" as explicit entities rather than hard-coded logic.
Summary updated