1

I need a tool that is like Google's transliterate that will convert Pinyin to Chinese Character. It works like this:

http://shawnwow.com/chineseCharacterHelpr/transliterateTest.htm

But since it is discontinued there isn't much of an API.

An alternative I found early on was this:

http://yuhanz.github.io/chinese-ime.html

But that also didn't have much flexibility to its layout. It was made by a guy over the weekend while he was super kind he doesn't provide support.

Basically what I am looking for is the ability to grab the characters and display them how I want instead of in the box they provide. If you delete transliterateTest.htm from the URL of the first (limited to 2 URLs) and you type a Chinese character and click hint you will have a stronger idea of what I am looking for. What I need is to click a character and have the IME reset and do it all again. I tried to hack at this one but the functionality of the IME is acting funky.

What I would love is one that just goes out and grabs a Character array based on the JSON and gives me complete control on how I want to parse through the array. So far this site is entirely in JavaScript and while we will be getting Python later on I am only helping with the JavaScript phase.

I was asking on the stackoverflow (tech site) but I saw someone asking about Chinese to pinyin translation and having moderate luck.

Disclaimer: I do not speak Chinese. This is for my University's Masters project.

1

Based on Google transliteration API: https://www.google.com/intl/en/inputtools/services/features/transliteration.html

You can use http request "https://www.google.com/inputtools/request?ime=pinyin&ie=utf-8&oe=utf-8&app=translate&num=10&text=wozaixuezhongwen" to convert text "wozaixuezhongwen" to "我在学中文" (I am learning Chinese)

so you can use any language (Python, JavaScript, Java, ...) to send the http request and read the response, and build you own application flexibility.

  • Thank you! That's exactly what I was looking for. I hope this is fast enough that on keyup I can get the new set of characters. Do you know what candidate_type and lc is for? I am hoping the annotations work when I do it in browser. I am looking at the text file and for mao they all just say mao, no annotation. – shellwe May 17 '17 at 14:41
  • I do have to say, I searched that the Google Input tools back and front and could not find how to set up an HTTP request, how did you find it? I am asking to see if there is any extra info it gives. This is great though! – shellwe May 17 '17 at 14:56
  • @shellwe how to send http request is a topic about programming. just search "send http request by python" or by java. – treesong May 17 '17 at 15:22
  • Sorry, I know how to send HTTP requests, but how did you know that ime needs to equal 'pinyin' or app equals 'translate' and what num is and why it needs to be set to 10; that type of stuff? Like I am using the flickr API: flickr.com/services/api/flickr.photos.search.html and it has a huge list telling you what attributes you can use for a GET URL and what they do. Thank you again, this should allow me to make the character search to look how I want instead of having to use the pre-defined layout! – shellwe May 17 '17 at 19:44
  • treesong, I guess my question is how did you know what parameters to put together to create that HTTP request. Surely there is some guide from google that told you that num needs to be 10 if you want this or that. – shellwe May 21 '17 at 1:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.