API¶
This page defines an API reference for the vidyut package.
The tools we used to generate this page are optimized for pure Python modules. But since this package is not pure Python, these tools occasionally have issues when processing our code. Known issues:
Enum members don’t have docstrings.
Special methods (__new__, …) don’t have docstrings.
Function docs don’t have argument types or return types.
Properties and attributes don’t have types.
We will fix these issues as soon as we can. In the meantime, please refer to the extensive examples in Quickstart.
vidyut.cheda¶
vidyut.cheda segments and tags Sanskrit expressions.
vidyut.kosha¶
Consumer types¶
- class vidyut.kosha.Kosha¶
A compact Sanskrit kosha.
- __contains__(key, /)¶
Return key in self.
- __new__(**kwargs)¶
- contains_prefix(prefix)¶
Return whether the kosha contains at least one key with prefix prefix.
- get_all(key)¶
Return all entries with the given key.
- class vidyut.kosha.Pada¶
Morphological information for a Sanskrit word.
- dhatu¶
The verb root.
- is_purvapada¶
(For nominals) whether this word must not occur as the last member of a compound.
- lakara¶
(For verbs) the tense-mood.
- linga¶
(For nominals) the gender.
- static make_avyaya(*, pratipadika)¶
Create a new avyaya (indeclinable).
- static make_subanta(*, pratipadika, linga, vibhakti, vacana)¶
Create a new subanta (nominal).
- static make_tinanta(*, dhatu, purusha, vacana, lakara, pada_prayoga)¶
Create a new tinanta (verb).
- pada_prayoga¶
- pos¶
The part-of-speech.
- pratipadika¶
- purusha¶
- vacana¶
- vibhakti¶
(For nominals) the case.
Builder API¶
- class vidyut.kosha.Builder¶
Builder for a Kosha.
Memory usage is linear in the number of unique lemmas.
- finish()¶
Complete the build process.
If this method is not called, the output data will be invalid.
- insert(key, pada)¶
Insert the given (key, pada) pair.
Keys must be inserted in lexicographic order. If a key is received out of order, this method will raise an OSError.
vidyut.prakriya¶
Main types¶
Main types define the high-level API.
- class vidyut.prakriya.Ashtadhyayi¶
An interface to the rules of the Ashtadhyayi.
- derive_krdantas(*, dhatu, krt)¶
Return all possible krdanta prakriyas that can be derived with the given initial conditions.
- derive_subantas(*, pratipadika, linga, vibhakti, vacana)¶
Return all possible krdanta prakriyas that can be derived with the given initial conditions.
- derive_tinantas(*, dhatu, prayoga, purusha, vacana, lakara, sanadi=Ellipsis)¶
Return all possible tinanta prakriyas that can be derived with the given initial conditions.
- class vidyut.prakriya.Dhatupatha¶
Provides an interface to the Dhatupatha.
Output types¶
Output types define the output format of our API.
Input types¶
Input types define the input arguments for our API.
- class vidyut.prakriya.Lakara¶
The lakara to use in the derivation.
- AshirLin = Lakara.AshirLin¶
- Lan = Lakara.Lan¶
- Lat = Lakara.Lat¶
- Let = Lakara.Let¶
- Lit = Lakara.Lit¶
- Lot = Lakara.Lot¶
- Lrn = Lakara.Lrn¶
- Lrt = Lakara.Lrt¶
- Lun = Lakara.Lun¶
- Lut = Lakara.Lut¶
- VidhiLin = Lakara.VidhiLin¶
- class vidyut.prakriya.Linga¶
The linga to use in the derivation.
- Napumsaka = Linga.Napumsaka¶
- Pum = Linga.Pum¶
- Stri = Linga.Stri¶
- class vidyut.prakriya.Prayoga¶
The prayoga of some tinanta.
- Bhave = Prayoga.Bhave¶
- Karmani = Prayoga.Karmani¶
- Kartari = Prayoga.Kartari¶
- class vidyut.prakriya.Purusha¶
The person of some tinanta.
- Madhyama = Purusha.Madhyama¶
- Prathama = Purusha.Prathama¶
- Uttama = Purusha.Uttama¶
vidyut.sandhi¶
vidyut.sandhi handles sandhi changes between words.
- class vidyut.sandhi.Split¶
Models a sandhi split.
- first¶
The first part of the split.
- is_valid¶
Whether the split is phonetically valid according to some basic heuristics.
- second¶
The second part of the split.
- class vidyut.sandhi.Splitter¶
A sandhi splitter.
- static from_csv(path)¶
Create a sandhi splitter from the given path.
path should be a CSV with columns first, second, and result.
- split_at(text, index)¶
Return all possible ways to split text at the given index.
The first field in the split is guaranteed to be non-empty.