Ashtadhyayi Simulator API Reference

This page contains the detailed API reference for the Ashtadhyayi Simulator module.

Classes

class sanskrit_grammar.ashtadhyayi_simulator.PaniniSutras[source]

Bases: object

__init__()[source]

Initialize the PaniniSutras class with predefined sets of rules. For simplicity, we’ll demonstrate a few Sutras for noun declensions.

apply_sutra(rule, word)[source]

Apply a specific Paninian sutra on the given word. :param rule: The rule identifier (such as ‘nakara_svara’) :param word: The word on which the rule should be applied :return: The transformed word after applying the rule

Parameters:
nakara_svara(word)[source]

This rule deals with the transformation of certain consonants like ‘n’ into their appropriate vowel sounds. For demonstration purposes, let’s apply a simple transformation. Example: “न” to “नं” (like “नकार” becoming “नं”).

vowel_to_vowel_rule(word)[source]

This rule demonstrates a simple vowel transformation (like an ‘a’ changing to ‘i’ in some cases). Example: “राज” becomes “राजी” in the nominative singular.

apply_declension(word)[source]

Simulate the application of declensions to a word. Example: The word might change based on gender, number, or case.

Methods

PaniniSutras.apply_sutra(rule, word)[source]

Apply a specific Paninian sutra on the given word. :param rule: The rule identifier (such as ‘nakara_svara’) :param word: The word on which the rule should be applied :return: The transformed word after applying the rule

Parameters:
PaniniSutras.nakara_svara(word)[source]

This rule deals with the transformation of certain consonants like ‘n’ into their appropriate vowel sounds. For demonstration purposes, let’s apply a simple transformation. Example: “न” to “नं” (like “नकार” becoming “नं”).

PaniniSutras.vowel_to_vowel_rule(word)[source]

This rule demonstrates a simple vowel transformation (like an ‘a’ changing to ‘i’ in some cases). Example: “राज” becomes “राजी” in the nominative singular.

PaniniSutras.apply_declension(word)[source]

Simulate the application of declensions to a word. Example: The word might change based on gender, number, or case.

Example Usage

# Create an instance of PaniniSutras
panini = PaniniSutras()

# Apply a specific sutra
result = panini.apply_sutra('nakara_svara', 'नकार')
print(result)  # Output: नकारं

# Apply vowel transformation
result = panini.apply_sutra('vowel_to_vowel_rule', 'राजा')
print(result)  # Output: राजी

# Apply declension
result = panini.apply_declension('देवा')
print(result)  # Output: देवां