Google Input Tools "API" -- can it be used?
Asked Answered
W

1

19

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.

Waterage answered 20/8, 2013 at 7:14 Comment(3)
This is great. Thank you. How did you figure this out? I'm interested in Bengali. What should be the itc for that? And what is itc?Tasteful
@Tasteful Did you figure it out?Azeotrope
At google.com/inputtools/try it will show you the full list of languages. Same with translate.google.com I believe.Power
W
13

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

Waterage answered 1/9, 2013 at 22:1 Comment(3)
Hey Ash, I am also working on a similar problem. In your opinion, does it violate any google's policy ? I mean, would google have any problem if I use it on my website ?Hortenciahortensa
I can't speak to this legally. However, it's client-side code that means Google is still benefiting from collecting a user's keystrokes which is probably what they want. As long as you don't store the results (like all other Google services), and provide Google attribution, I don't see the problem.Waterage
@ash Hi, I have been trying to use your plugin, but cannot get it working. Could you please check here what I am doing wrong. jsfiddle.net/7dk6L9b0/1 . Thanks a lot.Malia

© 2022 - 2024 — McMap. All rights reserved.