Frage

I noticed that Google accepts transliteration and IME requests in any language through the url:

https://inputtools.google.com/request?text=$&itc=$&num=$\
    &cp=0&cs=1&ie=utf-8&oe=utf-8&app=test

where $ is a variable below, for any language and text.

For example, French (try it):

var text = "ca me plait",
    itc = "fr-t-i0-und",
    num = 10;
// Result:
[
    "SUCCESS",
    [
        [
            "ca me plait",
            [
                "ça me plaît"
            ]
        ]
    ]
]

Or, Mandarin (try it):

var text = "shide",
    itc = "zh-t-i0-pinyin",
    num = 5;
// Result: 
[
    "SUCCESS",
    [
        [
            "shide",
            [
                "使得",
                "似的",
                "是的",
                "实德",
                "似地"
            ],
            [],
            {
                "annotation": [
                    "shi de",
                    "shi de",
                    "shi de",
                    "shi de",
                    "shi de"
                ]
            }
        ]
    ]
]

All languages work and return great suggestions. The thing is I can't find documentation for this anywhere on the web, although it clearly looks like an API. Does anyone know if there is an official Google client or if they're okay with raw, unauthenticated requests?

It's used perhaps unofficially by plugins like jQuery.chineseIME.js, but I would appreciate any official usage information.

War es hilfreich?

Lösung

Whatever. I created my own plugin that uses it for Chinese, and can be extended easily: https://bitbucket.org/purohit/jquery.intlkeyboard.js.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top