0

I am aware that Google allows transliteration from English to several languages (www.google.com/transliterate).

I have an English word-list. I would like to transliterate (not translate) every word to Bengali (a language Google supports) - to obtain output in the form of a Unicode word-list.

Is there a way to use the transliteration API in Python to do this?

casperOne
  • 73,706
  • 19
  • 184
  • 253
Velvet Ghost
  • 408
  • 1
  • 9
  • 27
  • I haven't tried anything because I don't know where to start. I've never done something like this before. – Velvet Ghost Apr 24 '12 at 12:08
  • I looked up the google transliteration api documentation but couldn't find anything that might help me use it in the manner I want. – Velvet Ghost Apr 24 '12 at 12:09
  • And - I'm not asking for someone to spoon-feed me with ready code. I'm just asking for a pointer in the right direction - I'll do the rest myself, or at least try to. – Velvet Ghost Apr 24 '12 at 12:14

4 Answers4

2

This is the getting started documentation: http://code.google.com/apis/language/transliterate/v1/getting_started.html#transliterateLowLevel

If you only need to use it one time, it's probably easiest to use the example code to perform your transliteration in a browser.

If you can figure out the actual requests to make (shouldn't be hard, you can observe them in your browser's developer tools), you can re-implement that using the requests module (just get it with pip).

Marcin
  • 48,559
  • 18
  • 128
  • 201
1

Try the unidecode module

KurzedMetal
  • 12,540
  • 6
  • 39
  • 65
0

The Google Transliteration API is a javascript API meant to be used by web pages. There isn't anything about direct usage from programming languages or RESTful web services interface. This means that in order to use it from python, you would need to reverse engineer the calls made to the server (Not sure this is allowed though).

Another solution would be to use a Selenium web driver. You would need to install a browser and the Selenium web driver. Then, you would be able to control the browser from python (write text fields, read the results).

kgiannakakis
  • 103,016
  • 27
  • 158
  • 194
  • If it's a JS API, you wouldn't even have to write to page elements as you could probably get away with just directly injecting and running JS on any arbitrary page. – Silas Ray Apr 24 '12 at 13:28
0

Also, there's https://github.com/davisp/python-spidermonkey found in Best way to integrate Python and JavaScript?. At least a place to start looking.

Community
  • 1
  • 1
Silas Ray
  • 25,682
  • 5
  • 48
  • 63