An Emacs package for translating and analyzing Sanskrit, Pāli, Tibetan, and Chinese texts using the Dharmamitra.org API.
- Grammar analysis for Sanskrit
- English translations for Sanskrit, Chinese, Tibetan, Pali
- Segmentation and lemmatization
- Detailed grammatical analysis with meanings
- Download
dharmamitra.elto your local system - Add the following to your
.emacsorinit.el:
;; Add the directory containing dharmamitra.el to load-path
(add-to-list 'load-path "/path/to/directory/containing/dharmamitra")
(require 'dharmamitra)By default, translations are included in the analysis output. To disable translations (which makes the system significantly faster), add this to your .emacs:
(setq dharmamitra-text-include-translation nil)To re-enable translations:
(setq dharmamitra-text-include-translation t)In order to enable the key binding, add this to your .emacs:
;; Bind to a different key globally
(global-set-key (kbd "C-c g") #'dharmamitra-text-analyze-grammar)
;; Or bind for specific modes
(add-hook 'sanskrit-mode-hook
(lambda ()
(local-set-key (kbd "C-c g") #'dharmamitra-text-analyze-grammar)))- Select the text you want to analyze
- Press
C-c g(or your custom keybinding) - The analysis will appear in a separate buffer showing:
- Original text
- Segmented form
- Lemmatized form
- Translation (if enabled)
- Detailed grammatical analysis
The analysis buffer will be named *Dharmamitra Text Grammar*.
- Emacs 26.1 or later
- curl (for API requests)
- Internet connection to access dharmamitra.org
This package requires access to the Dharmamitra.org API. Make sure you have a working internet connection when using it.
The preprint to this system is available on arxiv.
There is also a github repository with the actual models and description on their use here.
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},
}
