Skip to content

vyasa-phonetics Crate Reference

vyasa-phonetics provides foundational, zero-runtime-dependency Rust types and algorithms for Vedic and Classical Sanskrit phonetics.


vyasa-phonetics
├── sound # Varṇa, Vowel, Consonant, Ayogavāha, Svara representations
├── pratisakhya # Śaunaka's Ṛgveda-Prātiśākhya (Śaiśirīya order, Nāmin, Mātrā)
├── panini # 14 Māheśvara Sūtras & dynamic Pratyāhāra engine
├── articulatory # Śikṣā Sthāna, Ābhyantara & Bāhya Prayatna classifications
└── varnamala # Standard pan-Indic Laukika Varṇamālā sequences

Represents an individual Sanskrit phoneme:

pub enum Varna {
Vowel(Vowel),
Consonant(Consonant),
Ayogavaha(Ayogavaha),
}

Full inventory of short, long, and pluta vowels, plus Dravidian shorts:

pub enum Vowel {
ShortA, LongA,
ShortI, LongI,
ShortU, LongU,
ShortR, LongR,
ShortL, LongL,
DravidianShortE, LongE,
Ai,
DravidianShortO, LongO,
Au,
}

All 33 classical consonants, plus Vedic retroflex flaps:

pub enum Consonant {
// Ka-varga (Velar)
Ka, Kha, Ga, Gha, Nga,
// Ca-varga (Palatal)
Ca, Cha, Ja, Jha, Nya,
// Ṭa-varga (Retroflex)
Tta, Ttha, Dda, Ddha, Nna,
// Ta-varga (Dental)
Ta, Tha, Da, Dha, Na,
// Pa-varga (Labial)
Pa, Pha, Ba, Bha, Ma,
// Antastha (Semivowels)
Ya, Ra, La, Va,
// Ūṣman (Sibilants & Glottal)
Sha, Ssa, Sa, Ha,
// Vedic flaps
LVedic, // ळ (ḍa-kāra-sthāne)
LhVedic, // ळ्ह (ḍha-kāra-sthāne)
}

Vedic suprasegmental pitch accents:

pub enum Svara {
Udatta,
Anudatta,
Svarita,
DirghaSvarita,
}

Specialized carrying sounds:

pub enum Ayogavaha {
Anusvara,
Visarga,
Jihvamuliya,
Upadhmaniya,
Gomukha,
Dvibindu,
Ardhavisarga,
}

Implements phonological rules from Sage Śaunaka’s Ṛgveda-Prātiśākhya.

pub const SAISIRIYA_VOWELS: [Vowel; 8] = [
Vowel::ShortA,
Vowel::ShortR,
Vowel::ShortI,
Vowel::ShortU,
Vowel::LongE,
Vowel::LongO,
Vowel::Ai,
Vowel::Au,
];

Returns true if the vowel belongs to the Nāmin class (all vowels other than a and ā, per RPr. 1.65). Nāmin vowels trigger retroflexion (Nati) of dental s and n.

Returns true if the vowel is a simple, homogeneous vowel (a, ā, ṛ, ṝ, i, ī, u, ū, ḷ).

Returns true if the vowel is a composite diphthong (e, o, ai, au).

Returns the moraic value:

  • Short vowels: 1
  • Long vowels / diphthongs: 2

Implements Pāṇini’s 14 Māheśvara Sūtras and dynamic Pratyāhāra decoder.

pub const MAHESHWARA_SUTRAS: [&str; 14] = [
"a-i-u-ṇ",
"ṛ-ḷ-k",
"e-o-ṅ",
"ai-au-c",
"ha-ya-va-ra-ṭ",
"la-ṇ",
"ña-ma-ṅa-ṇa-na-m",
"jha-bha-ñ",
"gha-ḍha-dha-ṣ",
"ja-ba-ga-ḍa-da-ś",
"kha-pha-cha-ṭha-tha-ca-ṭa-ta-v",
"ka-pa-y",
"śa-ṣa-sa-r",
"ha-l",
];

evaluate_pratyahara(name: &str) -> Option<Vec<Varna>>

Section titled “evaluate_pratyahara(name: &str) -> Option<Vec<Varna>>”

Expands any valid Pāṇinian two-letter abbreviation per rule 1.1.71 (ādir antyena sahetā):

use vyasa_phonetics::panini::evaluate_pratyahara;
let ik = evaluate_pratyahara("ik").unwrap();
// Returns [Vowel(ShortI), Vowel(ShortU), Vowel(ShortR), Vowel(ShortL)]
let hal = evaluate_pratyahara("hal").unwrap();
// Returns all 33 consonants

Implements the Śikṣā classification system.

pub trait ArticulatoryFeatures {
fn sthana(&self) -> Sthana;
fn abhyantara_prayatna(&self) -> AbhyantaraPrayatna;
fn bahya_prayatna(&self) -> Vec<BahyaPrayatna>;
}

Implemented for Varna, Vowel, and Consonant.


  1. no_std + alloc: Zero external dependencies, enabling direct compilation to WebAssembly.
  2. Zero Heap Allocation in Hot Paths: Phoneme inspection, classification, and table lookups operate on copyable stack enums.