Sanskrit Processor
A Python package for processing Sanskrit text using the Dharmamitra API.
Installation
pip install dharmamitra-sanskrit-grammar
Usage
from dharmamitra_sanskrit_grammar import DharmamitraSanskritProcessor
# Initialize the processor
processor = DharmamitraSanskritProcessor()
# Process a batch of sentences
sentences = [
"tapaḥsvādhyāyanirataṃ tapasvī vāgvidāṃ varam",
"nāradaṃ paripapraccha vālmīkirmunipuṃgavam"
]
# Using different modes
results = processor.process_batch(
sentences,
mode="lemma", # or 'unsandhied' or 'unsandhied-lemma-morphosyntax'
human_readable_tags=True
)
Available Modes
lemma: Basic lemmatizationunsandhied: Word segmentation onlyunsandhied-lemma-morphosyntax: Full analysis with word segmentation, lemmatization, and morphosyntax
Output format
Default is 'dict', but if you set it to 'string' you will get a simple string version of just the lemmas in 'lemma' mode or the unsandhied surface forms in 'unsandhied' mode. This should be handy for information-retrieval setups.
Project
You can visit an interactive version of this at [dharmamitra.org]. A github repository for the underlying model is here.
Citation
The preprint is available on arxiv. If you like our work and use it in your research, feel free to cite the paper:
@inproceedings{
nehrdichetal2024,
title={One Model is All You Need: ByT5-Sanskrit, a Unified Model for Sanskrit {NLP} Tasks},
author={Nehrdich, Sebastian and Hellwig, Oliver and Keutzer, Kurt},
booktitle={Findings of the 2024 Conference on Empirical Methods in Natural Language Processing},
year={2024},
}
License
This project is licensed under the MIT License - see the LICENSE file for details.
Release files for dharmamitra-sanskrit-grammar 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dharmamitra_sanskrit_grammar-0.1.7.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dharmamitra_sanskrit_grammar-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / dharmamitra_sanskrit_grammar-0.1.7.tar.gz
| Download URL | dharmamitra_sanskrit_grammar-0.1.7.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
079f4b6ce2ab4272cae3869fbf49f3d065fe733594ebe6db7ef90558e9d91062
|
|
BLAKE2b-256 checksum How to use checksums |
8dfbb4b6687733bc9a47c6a613ae500ba4c44412bd5e39c0e9228d7ff8e82dc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / dharmamitra_sanskrit_grammar-0.1.7-py3-none-any.whl
| Download URL | dharmamitra_sanskrit_grammar-0.1.7-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a88acb9cc5ab6c01084eaf9b9a5fe8d383336a8d5e0d0d1530f43e6afc51a77
|
|
BLAKE2b-256 checksum How to use checksums |
408759653c15fcc79dc5beea9bf5baf8e4831cc5679dd05cf6aeee2bd9414e8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|