Stem Generator API Reference

This page contains the detailed API reference for the Stem Generator module.

Core Functions

sanskrit_grammar.stem_generator.generate_sanskrit_compound(paraphrase)[source]

Helper Functions

sanskrit_grammar.stem_generator.alaukikavigraha(component1, component2)[source]

Function to handle the formation of an alaukikavigraha. Here, it combines the two components into a raw form.

sanskrit_grammar.stem_generator.samasa_anta(component)[source]

Adds the samāsānta element to the component. In real-world cases, there would be grammatical rules.

sanskrit_grammar.stem_generator.upasarjana_operations(component, position='before')[source]

Applies the upasarjana operation (prefix or suffix). This function handles the placement of upasarjana based on the position.

sanskrit_grammar.stem_generator.padakarya_operations(component)[source]

Apply padakārya operations on the words: phonological adjustments, etc.

sanskrit_grammar.stem_generator.finalize_case_and_gender(component, case='nominative', gender='masculine', number='singular')[source]

Finalize the gender, number, and case ending for the generated compound.

Parameters:
  • component (str) – The base compound stem

  • case (str) – Grammatical case (nominative, accusative, instrumental, etc.)

  • gender (str) – Grammatical gender (masculine, feminine, neuter)

  • number (str) – Grammatical number (singular, plural)

Returns:

The compound with appropriate grammatical ending

Return type:

str