A Python module to convert romanized Sanskrit (and other Indic languages) to Devanāgarī script.


The most recent version of this program is available at https://github.com/simonwiles/ur2ud.py/

You can download the zipped python library directly from Github using this link.


Converts Indic text romanized according to the ISO15919 conventions into Devanāgarī. Inspired in part by John Smith’s ur2ud (available here), and named in recognition of that fact.

With valid input, ur2ud.py is functionally equivalent to John Smith’s ur2ud -s, and as with the original implementation:

The program does not check that input is valid in terms of ISO 15919, or that UTF-8 input is syntactically valid. Invalid input will cause unpredictable results. Accented (Vedic) Roman input using acute and grave accents over vowels will produce correct but unaccented Devanagari output (the underscore notation for anudatta vowels is not currently supported, since it is not clear what its Unicode representation should be).

Note that where Professor Smith’s version generally drops invalid input characters, this program will return them in the result. I’m currently of the opinion that this is preferable.

Additional Functionality:

The program accepts a parameter (iast) which instructs it to expect input romanized according to IAST ( International Alphabet of Sanskrit Transliteration) instead of ISO15919. The most important differences are that IAST uses ‘ṃ’ instead of ‘ṁ’ for the anusvāra, and ‘ṛ’ and ‘ṝ’ instead of ‘r̥’ and ‘r̥̄’ for the short and long retroflex (murḍhanya) vowels respectively.


Usable as a python package:

1 >>> from ur2ud import Transliterator
2 >>> ur2ud = Transliterator(iast=True)
3 >>> devanagari = ur2ud.transliterate(roman)

or from the command line:

Usage: ur2ud.py
Read romanized Indic text from STDIN, and write Devanāgarī to STDOUT.

    --version   show program's version number and exit
    -h, --help  show this help message and exit
    -i, --iast  Expect IAST input (instead of ISO15919)