Zawgyi Unicode Exchange, a messenger bot for Myanmar facebook users

Aung Kyaw Htet
5 min readSep 3, 2016

--

Zawgyi Unicode Exchange. Last month I created a Facebook messenger bot for Myanmar language processing. Although I created this bot mainly out of curiosity, the bot has attracted some regular users over a few weeks. It has also given me some exposure into the world of chat bots and serverless computing. Recently, I have shared this knowledge at Myanmar Messenger Bots Demo Event in Myanmar. I hope this article will share the story more widely with everyone else on the internet.

What does it do? Firstly, let me be upfront that I have not invented anything new here. But I had the opportunity to integrate great technologies into a simple application which many Burmese found useful. Zawgyi Unicode Exchange is essentially a Myanmar text encoding converter, interfaced as a Facebook messenger bot. You enter text in one format (e.g. Zawgyi) in the chat box, and the bot replies you with the same text in another format (e.g. Unicode.) Basically, it is an echo bot with a twist and multiple hacks.

What are Zawgyi and Unicode? For non-Burmese readers, here is some background. There are two main encoding formats for writing Burmese language on the internet. Zawgyi, the format used by the majority of the Burmese, was created before Myanmar language was reasonably charted into the Unicode standard. Unicode Standard for Myanmar Language is now well developed, however it is not compatible with some of the configurations used by Zawgyi, the legacy format. Any text written in one format is not quite readable for another user, causing ineffective communication. Because of this issue, people started using converter apps, mostly online or mobile, to convert between Zawgyi and Unicode. Since the majority of Myanmar text is written on Facebook nowadays, I thought it would be useful to create a facebook messenger bot that can convert between the two formats. Here is some further reading on the story behind different encoding formats.

The animation below is a first demo in the bot’s early versions. It simply copies a text from a facebook post (a post written in Zawgyi, hence it looked illegible and ugly on the Android phone which does not support it.) When this text was pasted to the bot’s chatbox, the bot detects the format and replies the Unicode version of the input (hence a beautiful Burmese text can be seen in the reply.)

Zawgyi Unicode Exchange Bot Demo 1

A second video shows a later version of the bot with a more user friendly interface. The bot was tested simply by copy-pasting it’s instructions (written in Zawgyi) back into the chat box, which it then converted to Unicode and provided in the reply.

Zawgyi Unicode Exchange Bot Demo 2

The main reason for creating this bot however, was not about converting text encoding formats at all. I have long been fascinated by serverless computing platforms such as AWS Lambda, but never had a chance to use it before. I have also been curious about Facebook’s new messenger platform. Recently, I have come across Azure Functions, another serverless computing platform, and wanted to make a real application with it. There would be little point for me to create the same application on a traditional server-oriented platform as it would provide little learning experience.

Serverless Computing, or Function-as-a-Service (FaaS) have become easily accessible when AWS Lambda was launched in 2014. Serverless computing does not mean that you application does not require a server. However you write your application as a function, without worrying (much) about the server where the code will be executed, and the services that will enable the application (web servers, databases, logging etc.) This function can be invoked when triggered by certain events, such as a HTTP call. Your function program, should have an input and output, and the logic that gives an output for every input. Just like a function in mathematics, your function should always give specific outputs for every input, without any side-effects.

The architecture of Zawgyi Unicode Exchange bot is explained below.

The advantages of serverless computing are well exploited in this type of application. The process of conversion between encoding formats is a function after all, therefore it matches perfectly with a FaaS architecture. The main benefits I get from exploiting this paradigm, are cost, effort and scale. I do not have a run one or more Virtual Machines 24/7 and pay for the costs, but only need to pay for the number of times that the function is invoked. I do not also need to worry about maintaining the Virtual Machines, web servers, disk space and installing software packages. However the main advantage I get from using this architecture, is Auto-scaling. Azure Functions platform will manage how many instances of my function should be running at any particular time. When there are very few users for my bot, there may be only one instance of my code. When there are many concurrent users of the bot, Azure will launch as many function instances as required to handle these user requests in parallel. When no one has been using the bot for a while, Azure may shut down all instances, saving me cost. Most of all, I do not need to worry about my bot being crashed due to multiple concurrent users, which would certainly be a concern if I was running it on a single server.

Opensource libraries for processing Myanmar language have been crucial in the development of this application. I did not have to write a single line of code that detects the format of the input, and converts it to the other format. I would like to thank the authors of Rabbit Converter and Knayi-Myscript for their efforts in these libraries.

Zawgyi Unicode Exchange Bot can be accessed from its facebook page.

Further Reading

--

--

Aung Kyaw Htet

IT Architect / Consultant, passionate about A.I, Big Data & Cloud Computing.