How to model Sanskrit semantics in Rust?

28 views
Skip to first unread message

Arun Prasad

unread,
Oct 27, 2022, 11:14:32 PM10/27/22
to ambuda-discuss
Please let me know what you think of the in-progress schema below. Some parts of it are much more solid than others. Feedback on every part of it -- names, modeling, etc. -- are more than welcome.

I yanked this from my in-progress Rust schema, but you don't need to know Rust to follow along.

Notes:
- enum { A, B, C, ... } means we choose one of A, B, C, ...
- struct { A, B, C, ... } means we have all of A, B, C, ...

---

enum Linga {
    /// Unknown or missing gender.
    None,
    /// The masculine gender.
    Pum,
    /// The feminine gender.
    Stri,
    /// The neuter gender.
    Napumsaka,
}

enum Vacana {
    /// Unknown or missing vacana.
    None,
    /// The singular.
    Eka,
    /// The dual.
    Dvi,
    /// The plural.
    Bahu,
}

enum Vibhakti {
    /// Unknown or missing vibhakti.
    None,
    /// The first vibhakti (nominative case).
    V1,
    /// The second vibhakti (accusative case).
    V2,
    /// The third vibhakti (instrumental case).
    V3,
    /// The fourth vibhakti (dative case).
    V4,
    /// The fifth vibhakti (ablative case).
    V5,
    /// The sixth vibhakti (genitive case).
    V6,
    /// The seventh vibhakti (locative case).
    V7,
    /// The first vibhakti in the condition of *sambodhana* (vocative case).
    Sambodhana,
}

enum Purusha {
    /// Unknown or missing *puruṣa*.
    None,
    /// The first *puruṣa* (third person).
    Prathama,
    /// The middle *puruṣa* (second person).
    Madhyama,
    /// The last *puruṣa* (third person).
    Uttama,
}

enum Lakara {
    /// Unknown or missing *lakāra*.
    None,
    /// *laṭ-lakāra* (present indicative).
    Lat,
    /// *liṭ-lakāra* (perfect).
    Lit,
    /// *luṭ-lakāra* (periphrastic future).
    Lut,
    /// *lṛṭ-lakāra* (simple future).
    Lrt,
    /// *leṭ-lakāra* (Vedic subjunctive).
    Let,
    /// *loṭ-lakāra* (imperative).
    Lot,
    /// *laṅ-lakāra* (imperfect).
    Lan,
    /// *laṅ-lakāra* without its *a-* prefix.
    LanNoAgama,
    /// *liṅ-lakāra* in the sense of benediction (benedictive).
    LinAshih,
    /// *liṅ-lakāra* in the sense of a rule or injunction (optative).
    LinVidhi,
    /// *luṅ-lakāra* (aorist).
    Lun,
    /// *luṅ-lakāra* without its *a-* prefix (injunctive).
    LunNoAgama,
    /// *lṛṅ-lakāra* (conditional).
    Lrn,
}

enum Prayoga {
    Kartari,
    Bhavakarmanoh,
}

enum VerbPada {
    None,
    Parasmaipada,
    Atmanepada,
}

// In progress
enum Krt {
    Kta,
    Ktavatu,
    Shatr,
    Shanac,
    SyaShatr,
    SyaShanac,
    Krtya,

    Tumun,
    Ktva,
    Lyap,
}

enum Stem {
    Basic {
        stem: String,
        // One or more Linga elements.
        lingas: Vec<Linga>,
    },
    Krdanta {
        root: String,
        pratyaya: Krt,
    },
}

// Subanta (excluding avyayas)
struct Subanta {
    stem: Stem,
    linga: Linga,
    vacana: Vacana,
    vibhakti: Vibhakti,
    // Whether this *subanta* is part of some compound but not the final member of it.
    is_purvapada: bool,
}

struct Tinanta {
    root: String,
    purusha: Purusha,
    vacana: Vacana,
    lakara: Lakara,
    pada: VerbPada,
    prayoga: Prayoga,
}

struct Avyaya {
    stem: Stem,
}

enum Semantics {
    /// Unknown or missing semantics.
    None,
    /// A *subanta* (nominal, excluding *avyaya*s)
    Subanta(Subanta),
    /// A *tiṅanta* (verb).
    Tinanta(Tinanta),
    /// An *avyaya* (indeclinable).
    Avyaya(Avyaya),
}
Reply all
Reply to author
Forward
0 new messages