Wednesday, September 30, 2009

Xlit: CDAC Transliteration API

Welcome to the Xlit Ajax API usage-discussion blogpost !!

Note : Please note that usage of this free API for commercial applications is 'STRICTLY PROHIBITED'. Also, in case of interested in using this API,
please write to us so that your webpage can be linked from our repository.

Here, you can discuss any suggestions and/or issues involved with using the API for transliteration or give your feedback.

Xlit : Ajax API Usage Documentation

One of the easier ways to start learning about Xlit Ajax API is using the command line tool 'wget'; execute the following command:

wget --post-data 'srclang=en&trgtlang=hi&inpword=Hello&inputval=5&ui=xml' ""

Understanding the command:

This command performs a language transliteration (/xlit/editor/getXlatn) for hello (inpword=hello) from English to an Indian Language (here Hindi : srclang=en&trgtlang=hi). The other language options are listed elsewhere in this document. The response has a Content-Type of 'text/';charset=utf-8. The 'inputval' determines the # of possible alternatives of the given input word in the target language (limited to 5 as default higher limit).

The response returned to this request takes the format as specified with 'ui' in the query. The possible values that ui can take are :

'ui=xml' - This ui format returns the response in the form of a simple xml tree.[Content-Type: text/xml]

'ui=plain' - This ui format returns the response in the form of plain text readable in any text editor supporting unicode font rendering. [Content-Type: text/plain]

Note: Not including the variable 'ui' in the query, invokes the default response with 'Content-Type:text/html'

The following section shows a code snippet that demonstrates API access from Javascript:

xmlHttp= GetXmlHttpObject();"POST", url, true);




var formData ="srclang=en&trgtlang=hi&inpword="+encodeURIComponent('Hello')+"&inputval=5&ui=plain";


Similar API access from other languages/non-javascript environments like Flash, Java, PHP and Python, etc. is easily possible. You would be required to only construct the url and establish a connection.

Other Indian languages' support is in the pipeline for Marathi [mr], Tamil [tm], Telugu [tl], Kanada [kn] and Malayalam [ml].

We encourage you to participate and help us mould the API so that it serves you better day after day!

Post your comments/feedback/queries here.You may also wish to write to us at kbcs[AT]

Sarvesh Nikumbh
Xlit Team

No comments: