Using Google CGI API for Japanese Input

If you wish something new in Smart Keyboard, here is the place to ask!
Post Reply
osaka.area2316
Posts: 1
Joined: Sun May 15, 2011 7:08 pm
Phone: HTC Desire HD, Android 2.2

Using Google CGI API for Japanese Input

Post by osaka.area2316 »

Is it possible for you guys to implement Google CGI API for Japanese Input?
It says on their website that you can send a http request to http://www.google.com/transliterate via a GET method.
CGI parameter as following (Provided that it has been URL encoded):

langpair=ja-Hira|ja
text=(Whatever Hiragana that needs to be converted, without the brackets)

the Hiragana strings after the text=, should be encoded in UTF-8.

For example, if you want to request the conversion of the Hiragana string "へんかん", you would specify it as:

http://www.google.com/transliterate?lan ... B%E3%82%93

When the request has been sent, arrays of JSON format should be returned as a response.

The arrays' individual constituents are the "phrases" of the converted Hiragana,
with the First constituent being the original text string, and the second constituent being the list of conversion candidates.

Example:

When 「ここではきものをぬぐ」 is requested and specified,

JSON format like this returns:

[
["ここでは", ← this is the first constituent from the original Hiragana string
["ここでは", "個々では", "此処では"], ← this being the second constituent with the possible candidates.
],
["きものを",
["着物を", "きものを", "キモノを"],
],
["ぬぐ",
["脱ぐ", "ぬぐ", "ヌグ"],
],
]

There's also other string request rules for this API, but just implementing this basic piece of code would make a whole lot of difference in terms of Japanese Input.
Most of the smartphone users nowadays are on a large data plan, so sending tiny requests like this to the server shouldn't make that much of a difference in terms
of data usage per month.

Other option is to use Social IME, which is also an internet dependant Japanese dictionary.

It would also be quite cool to have the option to enable/disable the google dictionary, for those that are data conscious.

I'm not sure if this is even in the right direction of things, but it would be cool to see something like this as Smart Keyboard rocks my socks for everything else.
Post Reply