Convert among Devanagari transliteration systems
Project description
Devanagari Transliterators
Convert among common Devanagari transliteration systems. The following codecs are currently implemented.
System | Code | Decoder | Encoder |
---|---|---|---|
Devanagari | dev |
✓ | ✓ |
Hardvard Kyoto | hk |
✓ | ✓ |
IAST | iast |
✓ | ✓ |
ITRANS | itrans |
✓ | ✓ |
SLP1 | slp |
✓ | ✓ |
(La)TeX | tex |
✗ | ✓ |
Velthuis | vel |
✓ | ✓ |
WX | wx |
✓ | ✓ |
Installation
The best method to install is via pip
.
pip3 install devtrans
Clone the GitLab repository to install from the source.
Usage
As a script
transliterate -d dev -e iast -i input_file -o outputfile
The options
-d
Decoder system code (defaults todev
)-e
Encoder system code (defaults toiast
)-i
Input file (defaults toSTDIN
)-o
Output file (defaults toSTDOUT
)
See help for more details
transliterate --help
As a module
Import the module.
import devtrans
Call any codec function with appropriate input text
target = devtrans.wx2iast('xevanAgarI')
Devanagari encoders can have an optional boolean argument. If True
, which is default, the encoder transliterates digits to Devanagari digits. If False
, it leaves digits as it is.
target = devtrans.wx2dev('BagavaxgIwA 18.78', False)
Disclaimer
It has primarily been developed for personal use as a tea-time activity. Some of my colleagues and I are using it since 2015 for general texts from classical literature. I have been tweaking and making modifications whenever we found an issue. However, the transliterators are not tested exhaustively or thoroughly with various kinds of texts.
Majority of the transliteration schemes are case-sensitive. Currently, encoder/decoder for case-insensitve schemes works with lowercase characers only.
Many schemes use punctuation characters to represent letters which are represented using alphabets in another scheme. This makes punctuated text to be poorly transliterated. No character-escape mechanism is used.
Contribute
Find the repo on GitLab. If found bugs, please fix and push them, raise an issue or mail me.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.