Shriram Bhat
Work & Technology

Transliteration of Kannada to English (Latin) ISO 15919 in Python

By Shriram Bhat · 19 Aug 2018 · 3 min read
Two lines of a Kannada verse on paper, an arrow, and their ISO 15919 Latin transliteration

Are you a creature of illusion? Or is illusion your creation?
Are you a part of the body? Or is the body a part of you?
Is space within the house? Or is the house within space?
Or are both space and the house within the seeing eye?
Is the eye within the mind? Or is the mind within the eye?
Or are both the eye and the mind within you?

Saint-Poet Kanakadasa

What a deep reflection on the mind and perception, by the sixteenth-century saint-poet Kanakadasa (ಕನಕದಾಸ)!

If you enjoyed this verse, trust me, it sounds even better in Kannada (ಕನ್ನಡ), the language it was composed in. A translation can only give you one of the many possible readings of the original, and it loses the rhyme, the rhythm, the figures of speech, the shape and the mood along the way.

Kannada is rich in literature and culture, and it is the native language of about 44 million people in southern India. But that is only 0.5% of the world’s population. For the other 99.5%, the easiest way to read Kannada is romanisation. Thanks to colonisation, English became a common language across much of the world, and with it the Roman alphabet.

Romanisation is simply converting another writing system into the Roman (Latin) script: in our case, Kannada into Roman. Over time, several systems and standards have evolved to romanise Indic scripts, among them Hunterian transliteration, ITRANS, IAST and ISO 15919 (2001).

Two problems

Recently I built Kannada Kalike, a website for the Kannada Language Chair at Jawaharlal Nehru University (JNU) that teaches Kannada to people who don’t speak it. We had to transliterate a lot of text, and we faced two problems:

  1. Which standard of transliteration should we use?
  2. How do we transliterate so much text?

Hunterian is the most widely used system, but it has its drawbacks. It doesn’t distinguish retroflex consonants from dental ones: ಡ and ದ are both written as d. Marking the difference with capital letters would make the text hard to read. So after long deliberation, we chose ISO 15919 (2001), a standard that uses diacritics to map the much larger set of Indic consonants and vowels onto the Latin script. That solved the first problem.

The second was the sheer volume: typing out pages of transliterated text by hand would be tedious. Whenever I find something monotonous that follows a pattern, I find a way to automate it. I looked online and found some good tools and scripts, but some limited the length of the text, others weren’t accurate, and some were so heavy and complex that, as Joe Armstrong once put it, I asked for a banana and got a gorilla holding the banana, and the entire jungle. They were built for much larger purposes. I needed something simple and lightweight that would just do the job. So I built one myself: om_transliterator.

Maybe, if I had searched more, I would have found it. But my wish to save time and effort made sure that it found me.

What is om_transliterator?

om_transliterator is a Python package that transliterates text from the Kannada (Knda) Unicode script to the Latin (Latn) script, following ISO 15919.

How to install it

To install it with pip, run:

pip install om-transliterator

To install it from source, clone the repository and run:

python setup.py install

How to use it

om_transliterator is not an end-user tool. It is a small, lightweight Python package meant to be used in the backend of your own project. Here is a typical example, with the first line of Kanakadasa’s verse:

#!/usr/bin/env python
from om_transliterator import Transliterator
transliterator = Transliterator()
original_text = "ನೀ ಮಾಯೆಯೊಳಗೋ ನಿನ್ನೊಳು ಮಾಯೆಯೋ"
transliterated_text = transliterator.knda_to_latn(original_text)
# output: nī māyeyoḷagō ninnoḷu māyeyō

How to contribute

The project is open source under the Apache License 2.0, with contributions and support from people like Dinesh Shenoy, Prof. Purushothama Bilimale, Srikanth Lakshmanan, Sandesh B Suvarna, Arjun Shetty and many others.

The package is on PyPI at pypi.org/project/om-transliterator, and you can contribute extensions and fixes at github.com/shrirambhat/om_transliterator.

Let’s wait and see what finds me next…

Shriram Bhat builds AI agents for enterprise finance in Bengaluru and writes about work, everyday systems and being human. More about me